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
- Run
ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)" - Install Xcode. You can’t go on until this is finished, and it does take some time.
Git
brew install gitgit config --global user.name "Your Name" git config --global user.email "youremail@domain.com"- 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
- Follow the instructions on Jason Johnson’s A Smarter MAMP
MySQL
brew install mysql- Look in your homebrew’s Cellar (
/usr/local/Cellarby default) for the mysql folder, then copycom.mysql.mysqld.plistto~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/com.mysql.mysqld.plistmysql_install_db --rpmmysqladmin -u root password 'yourmysqlpassword'
PHP
- Open
/etc/apache2/httpd.confin your editor of choice - Remove the “#” comment marker from the line
#LoadModule php5_module libexec/apache2/libphp5.so 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.
brew install pythonbrew install distrubute
MySQLdb
- Grab the source from Source Forge
- Unarchive the download and
cdinto the folder python setup.py buildpython setup.py install- Test the install with
pythonimport MySQLdb. If you get no feedback, everything is working correctly.
Python Imaging Library
brew install pil
Django
cdinto whatever folder you want to keep the Django source ingit clone https://github.com/django/djangocd django- If you want to run a release version instead of trunk, run
git tagto see which releases are available thengit checkout 1.2.5where “1.2.5” is the version you want to run. If you want to run trunk, skip this step. python setup.py buildpython setup.py install
That’s certainly a lot less headache than before. Hope this helps some people out.