64-bit MAMPP Simplified with Homebrew

28 February 2011

About a year and a half ago I posted a pretty popular article “Snow Leopard and a 64-bit MAMP”. Since then I’ve discovered Homebrew, an excellent package manager for OS X. Having suffered a massive drive failure over the weekend and once again facing a clean install, I figured it was time to write an updated procedure for getting a MAMPP development environment running. For the philosophy behind my setup, check out the older article; for this one it’s pretty much just going to be commands to run.

Homebrew

  1. Run ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
  2. Install Xcode. You can’t go on until this is finished, and it does take some time.

Git

  1. brew install git
  2. git config --global user.name "Your Name"
    git config --global user.email "youremail@domain.com"
  3. Optional
    git config --global color.diff auto
    git config --global color.status auto
    git config --global color.branch auto
    git config --global color.interactive auto
    git config --global alias.st status
    git config --global alias.ci commit
    git config --global alias.co checkout
    git config --global alias.br branch

DNS + VirtualNameHost

  1. Follow the instructions on Jason Johnson’s A Smarter MAMP

MySQL

  1. brew install mysql
  2. Look in your homebrew’s Cellar (/usr/local/Cellar by default) for the mysql folder, then copy com.mysql.mysqld.plist to ~/Library/LaunchAgents
  3. launchctl load ~/Library/LaunchAgents/com.mysql.mysqld.plist
  4. mysql_install_db --rpm
  5. mysqladmin -u root password 'yourmysqlpassword'

PHP

  1. Open /etc/apache2/httpd.conf in your editor of choice
  2. Remove the “#” comment marker from the line #LoadModule php5_module libexec/apache2/libphp5.so
  3. sudo apachectl restart

Python

Thus far I’ve used the components that ship with OS X, but I’m actually going to let homebrew handle Python because the most frustrating parts of my old setup can be done in a single line if everything Pythonic is handled by homebrew.

  1. brew install python
  2. brew install distrubute

MySQLdb

  1. Grab the source from Source Forge
  2. Unarchive the download and cd into the folder
  3. python setup.py build
  4. python setup.py install
  5. Test the install with python
    import MySQLdb. If you get no feedback, everything is working correctly.

Python Imaging Library

  1. brew install pil

Django

  1. cd into whatever folder you want to keep the Django source in
  2. git clone https://github.com/django/django
  3. cd django
  4. If you want to run a release version instead of trunk, run git tag to see which releases are available then git checkout 1.2.5 where “1.2.5” is the version you want to run. If you want to run trunk, skip this step.
  5. python setup.py build
  6. python setup.py install

That’s certainly a lot less headache than before. Hope this helps some people out.