mediatribe.net -- Drupal and Web Development

Notice: this post was last updated 3 years 18 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

MAMP, drush and the command line

This often happens when you restore from a time machine backup or change computers: your command line utilities are not restored properly. You need access from the command line to mysql to be able to call drush mysqlc, drush updb, for example.

First, figure out where your mysql utility is: on my machine it is at /Applications/MAMP/bin/apache2/bin/mysql. There are also many other useful utilities there that drush needs, like mysqldump.

Once that is done, add the path to your $PATH variable, and use MAMP's .sock file on the command line, by typing this in the terminal:

echo 'export PATH=$PATH:/Applications/MAMP/bin/apache2/bin' >> ~/.bash_profile
source ~/.bash_profile
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

Now restart your MySQL server in MAMP, and you will have access to mysql, drush sqlc, and other neat commands, from the command line.