Installing Apache, PHP, and MySQL on Mac OS X Sierra This is an update for Mac OS X Sierra of a previous post on installing Apache, PHP, and MySQL for Mac OS X. Posted in Main Thread on September 29, 2016.

This is an updated version of our prior OS X development series. The newly released macOS 10.14 Mojave and the accompanying updates to Brew require significant changes compared to prior releases, necessitating a thorough revamp in the process.

Apache For Mac Sierra

Since macOS 10.12 we now use Homebrew's Apache, rather than the built-in version, but this new appraoch is more flexible and should continue to work on prior OS X versions. Buy overwatch for mac. Developing web applications on macOS is a real joy. There are plenty of options for setting up your development environments, including the ever-popular that provides a nice UI on top of Apache, PHP and MySQL.

However, there are times when MAMP Pro has slow downs, or out of date versions, or is simply behaving badly due to its restrictive system of configuration templates and non-standard builds. It is times like these that people often look for an alternative approach, and luckily there is one, and it is relatively straight-forward to setup. In this blog post, we will walk you through setting up and configuring Apache 2.4 and multiple PHP versions. In the second blog post in this two-post series, we will cover MySQL, Apache virtual hosts, APC caching, and Xdebug installation. This guide is intended for experienced web developers. If you are a beginner developer, you will be better served using.

XCode Command Line Tools If you don't already have XCode installed, it's best to first install the command line tools as these will be used by homebrew: $ xcode-select --install Homebrew Installation This process relies heavily on the macOS package manager called Homebrew. Using the brew command you can easily add powerful functionality to your mac, but first we have to install it. This is a simple process, but you need to launch your Terminal ( /Applications/Utilities/Terminal) application and then enter: $ ruby -e '$(curl -fsSL Just follow the terminal prompts and enter your password where required. This may take a few minutes, but when complete, a quick way to ensure you have installed brew correctly, simply type: $ brew --version Homebrew 1.7.6 Homebrew/homebrew-core (git revision a1ed; last commit 2018-09-25) You should probably also run the following command to ensure everything is configured correctly: $ brew doctor It will instruct you if you need to correct anything. Mojave Required Libraries When installing fresh on Mojave, I ran into a few libraries that were missing when completing all the steps below. To make things easier, please simply run these now: $ brew install openldap libiconv Apache Installation The latest macOS 10.14 Mojave comes with Apache 2.4 pre-installed, however, it is no longer a simple task to use this version with Homebrew because Apple has removed some required scripts in this release.

However, the solution is to install Apache 2.4 via Homebrew and then configure it to run on the standard ports (80/443). If you already have the built-in Apache running, it will need to be shutdown first, and any auto-loading scripts removed. It really doesn't hurt to just run all these commands in order - even if it's a fresh installation: $ sudo apachectl stop $ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null Now we need to install the new version provided by Brew: $ brew install httpd Without options, httpd won't need to be built from source, so it installs pretty quickly.

Upon completion you should see a message like: 🍺 /usr/local/Cellar/httpd/2.4.35: 1,648 files, 26.9MB Now we just need to configure things so that our new Apache server is auto-started $ sudo brew services start httpd You now have installed Homebrew's Apache, and configured it to auto-start with a privileged account. It should already be running, so you can try to reach your server in a browser by pointing it at you should see a simple header that says 'It works!' Troubleshooting Tips If you get a message that the browser can't connect to the server, first check to ensure the server is up. $ ps -aef grep httpd You should see a few httpd processes if Apache is up and running. Google