-- Drupal and Web Development

Notice: this post was last updated 3 years 7 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.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.