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: 


Nice post... I've been using

Nice post... I've been using the native Apache server in OS X for a while and am pleased with it. However, I have steered clear of CLI package management in OS X for fear of breaking something, but I am going to give Homebrew a hard look after reading this post. I'd like to be able to test different versions of PHP and MySQL and try out MariaDB in Lion and not depend on VMWare which is a resource hog for obvious reasons. Up to now, I've confined my PHP and MySQL package juggling to Ubuntu or whatever LInux distro I'm into...lately Arch.

This is good info. Thanks!

WIth Acquia Dev Desktop, you

WIth Acquia Dev Desktop, you could easily end up in the same place as I did with MAMP. It is a well done environment for working with local Drupal development, but as soon as you want to work with tools beyond what is provided, it may not work.

I am glad you mentioned Acquia Dev Desktop though. It is a great tool and I recommend it often at CharDUG meet ups.

Thanks for all you do to training Drupalers Tom!

LOL. Yeah, I wish this post

LOL. Yeah, I wish this post had been around when I started Drupaling, but I've only been Drupaling since Jan of 2011.

Reason #1: You can't use port

Reason #1: You can't use port 80 or 443, i.e. the default HTTP/HTTPS ports, with Dev Desktop.

I just finished setting this

I just finished setting this up on my machine and importing all of my formerly-on-MAMP local dev sites into it and it is humming along nicely! Thank you for sharing this writeup, Shrop.


MAMP is good, but it's gonna install everything from scratch. The same goes for PHP via homebrew. I have tried all of those. But you have to remember that your Mac comes bundled with Apache and PHP out of the box. You just have to add MySQL to the mix and get rolling.

Regards! ||

Thanks for the reminder. I

Thanks for the reminder. I have used MAMP and local PHP/Apache with MySQL added into the mix. I inevitably wind up needed PHP modules and configurations which those methods do not provide. If you can do your work with MAMP or better yet, the built-in PHP/Apache stuff in OS X, you should do that. Definitely go with the easiest solution to get up and running which fits your needs.

Thanks! yeah, some of us in

Thanks! yeah, some of us in the office found this out too. We installed xquartz, which is a another way to get this issue covered. I plan on blogging about changes between the originally docs and what is needed for 10.8 to work.

I have played a bit with

I have played a bit with running a VM. The issue for me is that VMs take up ram, that I need for other things. The other issue is that you have to really tweak things with shared folders and host files to allow me to browse the sites and edit the code on the VM, while using my Mac tools. If you have the ram and have those other issues resolved, those certainly are alternatives.

Thanks Bryan! That is exactly

Thanks Bryan! That is exactly correct. I had that fix in my docs, but haven't updated here. Will do that today. Thanks much!

Add new comment