MAMP Begone! An alternative Apache, MariaDB and PHP stack for Mac OS X

Update: The docs below are deprecated. Please refer to these docs going forward. Also, MAMPbegone is now brewStack! Thanks to @tlattimore for providing the cool name!

I have had an on and off relationship with MAMP over the years. I love how MAMP makes it super easy to install a nice stack of web server tools in an OS X Application, but it does have its share of limitations.

  • Running older version of PHP. Sometimes I would like to run a slightly newer version than is available.
  • Running Apache 2.0. No Apache 2.2 love in MAMP yet.
  • There isn't an easy way to add new PHP extensions. I recently needed XMLRPC and had to track down a binary from the Moodle community. Another example is intl. I needed that for some recent Symfony work.
  • Pear doesn't always work out of the box without some fixes.
  • While it is open source, if I have to compile much to fix MAMP, I might as well compile PHP from CLI from source as I did for years prior to using MAMP.

I do appreciate MAMP! It is great and I still recommend it for anyone who can live within its feature set and limitations. I often recommend it for new Drupal users. MAMP allows them to get started very quickly.

As I mentioned above, I have also spent a bit of my development life compiling Apache and/or PHP from source to build local development environments. This is something that I don't want to do again. So what do I want? I want to have a local development evironment with the following characteristics:

  • Easy to install and configure
  • Easy to upgrade
  • Easy to extend (Adding new PHP extensions or upgrading PHP)
  • php-cgi for use with Drush qd
  • Secure
  • Easy setup for virtual hosts and changes to the /etc/hosts file. I can, but don't need to spend the time configuring this by hand all the time!
  • Lastly, this needs to support my Drupal and Symfony development needs! I have included some additional bits I use, such as drush and Composer.

I decided on the following tools to provide Apache, MySQL, PHP and GUI/easy eay to setup vhosts and /etc/hosts file changes:


  • OS X Lion's Apache - I can totally live with Apple's supplied Apache 2.2 server. There is no need for me to maintain this component.
  • homebrew-php - This is magical! Using Homebrew to install PHP from Jose Gonzalez's repo allows me to install and run PHP 5.3, PHP 5.4, a number of standard extensions, and php-cgi. Since this is hosted on github, I can fork the repo and make my own changes and additions!
  • Homebrew's MariaDB formula - You can also use MySQL if you prefer.
  • VirtualHostX - I have used VirtualHostX for years with and without MAMP. It is the easiest way to manage local development Apache vhosts and the /etc/hosts file. Well worth the money!

Before we get into the install steps, I want to mention a couple of similar/realated blog posts which are worth checking out for additional options and thoughts on this process. I have tailored my install steps on what I need. You can take my post and the posts below to help develop your local development environment formula!

Install steps:

  • Install Homebrew:

$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL" 
$ brew install git 
$ brew update 
$ brew install drush 

  • Tap the wonderful homebrew-php from

$ brew tap josegonzalez/homebrew-php

  • Install composer for Symfony and other PHP package management

$ brew install composer

  • Generate php-cgi for use with drush-qd.

$ brew install php53 --without-apache --with-mariadb --with-intl --with-suhosin

  • Backup php-cgi and uninstall php53 since you homebrew-php will not install php-cgi and at the same time

$ cp /usr/local/Cellar/php53/5.3.13/bin/php-cgi ~/bin/ 
$ brew uninstall php53 

  • Install php 5.3 with apache, mariadb, intl (for Symfony 2), and suhosin patch

$ brew install php53 --with-mariadb --with-intl --with-suhosin

  • Now that php 5.3 is compiled for Apache, you can copy the php-cgi binary compiled previously to ~/bin or any other bin directory in the current path.
  • Add the following to /etc/apache2/httpd.conf

LoadModule php5_module /usr/local/Cellar/php53/5.3.13/libexec/apache2/

  • Install additional php extensions (Optional. Follow configuration instructions after each install.)

$ brew install php53-apc 
$ brew install php53-mongo 
$ brew install php53-uploadprogress 
$ brew install php53-xdebug 
$ brew install php53-xhprof 

  • Set your timezone for php. I used the following in /usr/local/etc/php/5.3/php.ini.

date.timezone = America/New_York

*Set the following for Symfony 2 compatibility in /usr/local/etc/php/5.3/php.ini:

detect_unicode = off

  • Set the Apache user and group directives to your user and group. Do this in the file /etc/apache2/httpd.conf
    • Restart Apache
    • This allows Apache to host sites in folders other than ~/Sites


  • Make sure Apache and MariaDB are not accessible outside of your Mac
    • MariaDB
      • Pick a cnf file from /usr/local/Cellar/mariadb/5.3.5/share/mysql and copy it to /usr/local/etc/my.cnf
      • I used my-medium.cnf
      • Edit my.cnf and add the following in the [mysqld] settings area:


  • For enhanced security, you can remove the above and add the following to my.cnf in the [mysqld] settings area. This prevents any TCP/IP connections to MariaDB. This changes will require your applications support database socket connections.


  • Issue the following command and follow the setup instructions to your liking. You will should get prompted by the system firewall to allow or deny mysqld connections when you first start MariaDB. Deny access!

$ brew info mariadb

  • Once you have it setup, issue this commend to start the server manually:
  • mysql.server start
  • Apache
    • Edit /etc/apache2/httpd.conf, replacing "listen 80" with


  • Make sure that new vhosts only listen to Same goes for any port.


  • Great Mac app for maintaining Apache vhosts and /etc/hosts entries. Of course, you can do this yourself.

Update: Hey, if you do this, please tweet a link to this blog post along with hastag #MAMPbegone

Blog Category: