Last Updated: February 25, 2016
·
2.157K
· shupal

Use drush on mac osx with mamp

Before you install drush make sure mamp is running.

On http://drupal.org/project/drush there is a installation command with pear but that doesn't work .... idk why. But on the documentation site is a alternative way to install drush on osx.

First step is to download drush in your home directory like /Users/username/drush or elsewhere. Just remember the path.

Next tell osx where to find drush

nano ~/.bash_profile
or
nano ~/.profile

and add

export PATH=$PATH:/Users/myusername/drush

Replace the Path /Users/myusername/drush if you install drush elsewhere. Now logout or reload the profile with

source ~/.bash_profile
. ./.profile

Or you can just create a symlink.

cd /usr/bin
sudo ln -s /Users/myusername/drush/drush

Don't forget to replace the path.

That's it.

If you got an error after you used a drush command like

"Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)".

You can solve the error with

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

Checkout http://drupal.org/node/1674222 and http://drupal.org/node/1651282 for more information.