Installing Drush on Mac OS X "Snow Leopard"

To those wishing to install Drush on their Mac, but having difficulty, here's a surefire way to get it running great:

[Edit: Umm... instead of doing all the steps below, you can use Homebrew (the 'missing package manager for Mac OS X') and enter $ brew install drush. Much simpler!]

  1. Fire up the Terminal (this is why you're using Drush, so you'd better get comfy in here!).
  2. cd to your Desktop, download drush, and extract it.
    $ cd Desktop $ wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz $ tar -xvzf drush-6.x-3.3.tar.gz
  3. Move the drush directory to /usr/local/lib
    $ sudo mv drush /usr/local/lib
  4. Make drush executable.
    $ sudo chmod u+x /usr/local/lib/drush/drush
  5. Make a symbolic link to drush in /usr/bin
    $ sudo ln -s /usr/local/lib/drush/drush /usr/bin/drush
  6. Set up an alias in your bash environment so you can type 'drush command' rather than '/usr/bin/drush command'
    $ cd ~
    $ nano .profile
    # Inside the .profile file:
    alias drush='/usr/bin/drush'
    # Then press control-O + return to write the file, and control-X to exit nano
    $ source .profile

Now, you can simply enter 'drush command' to use drush.

Jeff Geerling is the owner of Midwestern Mac, LLC. He is an active contributor in the Drupal community, and has primarily been a Mac user since the 1990s. He is the author of Ansible for DevOps, and learns and uses whatever tool or language is best for the job.

Comments

Boris Mann's picture

I was going to mention Homebrew. Also, wget is not installed out of the box with Snow Leopard, so your suggested method will fail. And, adding /usr/local/bin to your PATH means that "drush" will just work -- aliases can cause issues if you end up trying to run drush with system users other than your own.

Jeff Geerling's picture

I didn't think about that... many of my assumptions are based upon the fact that I'm the only one that ever uses my Macs :D

I will update the guide accordingly... but Homebrew looks to be the best solution by far. I used to use fink, but hated configuring it. Homebrew solves the config problems, and then some.

Personal site: jeffgeerling.com.

Chris Luther's picture

While I was excited to find a possible replacement for MacPorts, the installation instructions for HOMEBREW strongly suggest that you delete the "/usr/local/include" and "/usr/local/lib" directories. On my system both of these directories contain "stuff" and it seemed easier to simply follow these directions for installation than invest the time in a painful recovery because something was dependent upon a file in this directory.

I was able to successfully install Drush using these instructions in 2 minutes (THANKS!). I'm off to doing work now, but I'm curious if I was too conservative in choosing not to install HOMEBREW.

Jeff Geerling's picture

I don't use Homebrew on all my Macs. Just those that require more than a few packages over time. For my main mac, I actually just install binaries manually (and create the links like I outline in this article).

Personal site: jeffgeerling.com.

Add new comment