Compiling a WordPress Development Environment in OS X

Compiling a WordPress development environment in OS X is something that some people still like to do.

If you want to compile your development environment from scratch, instead of using packages included with OS X, and without resorting to third party package managers like Homebrew, then check out my guide on GitHub (lukejanicke / wp-mac-dev-env).

The guide contains complete instructions for compiling a WordPress development environment in OS X from scratch. All essential packages and their dependencies are compiled from the latest source code and configured manually, including packages already bundled with OS X. This gives you full control over a cutting edge environment at the expense of some convenience.

The development stack is a typical MAMP environment—Macintosh/OS X, Apache, MySQL, and PHP—which, along with WP-CLI, support WordPress.

It’s based on Patrick Bougie’s excellent Compiling a Web Development Environment on Mac OS X. For a more comprehensive web development environment, and instructions for previous versions of OS X, please refer to Patrick’s guide.

My guide only includes the packages and dependencies necessary for a basic WordPress development environment (i.e. themes and plugins). It also adds some necessary steps for newer package versions, and includes instructions for configuring Apache virtual hosts, WordPress and WP-CLI.

The environment described is not suitable for production. To create a local environment that more closely resembles a production environment in terms of security and features, take a look at Vagrant, Docker and Roots.

Compiling Python 3 in OS X

Don’t use the Xcode-beta version of Command Line Tools if you are trying to compile Python 3 in OS X.

You really shouldn’t be compiling Python 3 from source on a Mac. El Capitan comes with Python 2.7.10 and you can easily install the latest Python 3 with the official OS X installer package or via Homebrew. But if you are (at approximately the time of writing this), use the Command Line Tools that come with Xcode proper and not the beta version.

sudo xcode-select -s /Applications/

There’s a few more details in my post on Stack Overflow.

If you try to make and make install Python 3 (3.5.2 at this time) with the Xcode-beta version of Command Line Tools, you’ll get an error and the build will fail. You’ll get the same error if you try to use pyenv.

If you switch back to the regular “toolchain”, you’ll still get a lot of warnings and notices about uninstallable components when you make and make install Python, but it will compile successfully.