Last updated 9 December 2016. Created on 21 June 2012.
Edited by ShaunDychko, attheshow, Melissamcewen. Log in to edit this page.

The current version of MAMP may require some troubleshooting to get Drush to work correctly. Known issues include:

  • Default use of php5.3.6 instead of php5.2.17 causes errors upon update, most commonly "Cannot redeclare class" errors. To solve, change the version of PHP in the MAMP preferences panel or add a line in your .bash_profile to tell Drush to use the right version of PHP export DRUSH_PHP="/Applications/MAMP/bin/php/php5.2.17/bin/php".
  • Inability to connect to localhost MySQL via socket. Causes errors like "Error: PDO::__construct(): [2002] No such file or directory (trying
    to connect via unix:///var/mysql/mysql.sock)". To solve, from within Terminal run the following commands:

    sudo mkdir /var/mysql
    sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
    Or, if this error appears with MAMP4, consider checking the "Make this version available on the command line" option.
mamp_4_drush.png71.18 KB

Looking for support? Visit the forums, or join #drupal-support in IRC.


mori’s picture

I am using MAMP 2.x on OS X 10.6.8 and OS X 10.8.4

I get this response running "brew doctor" (OS X 10.8.4 with MAMP Pro 2.1.4):

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:


Consider amending your PATH so that /usr/local/bin
occurs before /usr/bin in your PATH.

Warning: Homebrew's sbin was not found in your path.
Consider amending your PATH variable so it contains:

Any suggestions what to do and how?

pratik60’s picture

Been working an hour to get this done

scott.whittaker’s picture

I've just switched to MAMP Pro 3, and it's awesome, but there are a few changes that need to be dealt with for drush to use the correct php.ini file.

In this version of MAMP, you edit the php.ini file by selecting File --> Edit Template --> PHP --> PHP {version} php.ini

This template is actually saved to /Library/Application Support/appsolute/MAMP PRO/conf/php.ini rather than /Applications/MAMP/bin/php/php{version}/conf/php.ini - which does still exist.

I already had the path to the version of PHP I wanted to use in my .bashrc file:

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

and created an alias there to execute PHP with the correct ini file from the command line:

alias php='php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php.ini"'

which runs perfectly when executing PHP from the command line.

Unfortunately drush does not respect this and insists on using the php.ini file from the same location as the php binary.

There does not seem to be any configuration setting that will tell drush which php.ini file to use, but eventually I discovered that a symlink from the php.ini file into ~/.drushrc does work:

ln -s "/Library/Application Support/appsolute/MAMP PRO/conf/php.ini" ~/.drush/

If anyone has a better method I'd love to hear it.

asauterChicago’s picture

ln -s "/Library/Application Support/appsolute/MAMP PRO/conf/php.ini" ~/.drush/

+1 for this. To respond to the last post on this page, the Drush documentation is actually outdated. Adding the symlink was the only thing that worked for me on Yosemite and MAMP 3.2.1. Otherwise it was still using the wrong PHP.ini file.

JMGordon613’s picture

Thanks a bunch! Drush seems to work again with MAMP 3.0.5 and OS X 10.11 Capitan.


bryanbraun’s picture

I found these suggestions out of date. I'd say the best place to look for the most up-to-date instructions regarding Drush and MAMP is the Drush readme on Github. It contains a section for MAMP-specific setups.

: Bryan

d1v9d’s picture

This resolved my problem!!

knalstaaf’s picture

This error occured after updating MAMP. It was solved by using the following commands in Terminal:

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock


Rick Hood’s picture

I had to uninstall and reinstall MAMP PRO 4.1.1 and this fix worked for me to get Drush running again also:

sudo mkdir /var/mysql
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock