Installing Drush on a Mac for idiots (like me)

So i've just got Drush running on my mac, like many things command line the install instructions have a number of assumptions. After ploughing through lots of forums and help pages and running headlong into a few errors here's my take on it.

I'm currently running OS 10.7.5 and MAMP 1.9.1 - they aren't the latest i know, but i dont hate myself so i'm not upgrading just yet.

Get Drush
Go here: https://github.com/drush-ops/drush
download it via Git if you like or just use the download zip option on the right (Git is good - but i'm not going through all the git stuff here). Uncompress it and put it somewhere handy.

Install Drush Manually
If you're smart enough to use the other options then you don't need this tutorial. So scroll down to the install manually bit on the above page and follow the instructions. Use the first option in part 3.

Post Install
Do what it says on the above page in part 1. But thats perhaps not so obvious, so go here:
https://github.com/drush-ops/drush/blob/master/examples/example.bashrc
Read what it says at the top. i.e.:

Copy this file to your home directory, rename and customize it to
# rename this to .drush_bashrc, and in your
# ~/.bash_profile add:
#
#
# if [ -f ~/.drush_bashrc ] ; then
# . ~/.drush_bashrc
# fi

So that means getting the example.bashrc copying it to your user directory and renaming it .drush_bashrc (it will instantly disappear after this as the dot makes it invisible). I use Transmit to do my FTP work and i find this useful to use as a browser if i want to see invisible files. Equally you can use Terminal of course.

Then open up a file called .bash_profile which is in your user folder (i.e. here: ~/). If there isn't one there you can create one.
Add the lines:

if [ -f ~/.drush_bashrc ] ; then
. ~/.drush_bashrc
fi

Configuration for MAMP
The first bit worked for me on the Drush help section, i.e. adding this to the .bash_profile

export PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"

But I kept getting errors when trying to do certain Drush commands, for instance "drush pm-update" gave errors like this:

Command pm-update needs a higher bootstrap level to run - you will [error]
need to invoke drush from a more functional Drupal environment to run
this command.
...

I found the solution here: https://drupal.org/comment/2914148#comment-2914148
Look at that comment first as it may differ for you, but for me this worked:

sudo ln -f /Applications/MAMP/bin/php5.3/bin/php /usr/bin/php

Add new comment