02 April 2012

I use a Mac with MAMP Pro to do local development. Sometimes the paths on MAMP Pro can be a little tricky and getting Drush installed may be more command line than you’re comfortable with. Here’s a quick way to get Drush installed in the command line with MAMP Pro. 1.

Make MAMP your primary php binary. So when you get a mac and install MAMP Pro there are now two versions of php installed on your machine. The one that came with MAMP Pro and the one that came with Mac OS X. You need to tell the command line that you want to use MAMP Pro’s PHP rather than the one that came with your mac. You do that by setting the path variable. At the command line type

> echo $PATH

and the command line will respond with something similar to this:


MAMP Pro’s copy of php is inside this folder:


There should be two versions: A php 5.3.x and 5.4.x. You can tell which version you’re using by opening MAMP Pro and choosing Server then PHP.

This version of MAMP Pro uses PHP version 5.3.6. so inside


is a folder 5.3.6. This is where the version of php lives that we want Drush to use. If Drush uses another version, you’re going to have problems with executing drush commands so lets add this version of PHP to the PATH variable. We do that by editing the .bash_profile

file in our User’s home folder and adding the following line:

export PATH=/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php5.3.6/bin:$PATH

Save the .bash_profile file and close all Terminal.app windows. When you open a new Terminal.app window, try this:

echo $PATH

You should get something like this:


when you type

which php

it should answer


when you type

which pear

it should answer


You’re now ready to install Drush.

  1. Install Drush 5.0 or newer. Easiest way is through PEAR: if the console_getopt pear module is not installed, install it:

>pear install Console_Getopt

if it is installed

>pear upgrade --force Console_Getopt

>pear upgrade --force pear

>pear upgrade-all

>pear channel-discover pear.drush.org

>pear install drush/drush

If you installed Drush prior to March 31, 2012, please upgrade to 5.0. If you’re not sure which version you have installed,

>drush version

will tell you the currently installed version.

  1. Install drush registry rebuild. One change between Drupal 6 and Drupal 7 is a database table called “registry”. this table holds the location of all your module files. If those files or any of their associated classes for any reason change location your Drupal install will white-screen. The Jenkins build script which is in this directory in a file called


As part of every build, this shell script instructs Jenkins to do a registry rebuild to fix any modules that might have moved since the last build and avoid white-screens when file locations change. if drush is installed correctly, you can simply

drush dl registry_rebuild