Installing Drush 7 on MacOSX with Composer

Acquia Dev Desktop comes with Drush pre-installed. So, if you’re already using Acquia Dev Desktop, you already have Drush on your machine, and you’re ready to begin the series. If you’re using another AMP stack, such as MAMP, this video will show you how to install Drush 7 on Mac OSX with Compser.

The process to install Drush 7.0.0 and up is in some ways more complicated than previous versions, but it's also much simpler for other reasons. For example, in order to install Drush, you have to install Composer first, but Composer is required for Drupal 8 (so you might need to install it eventually anyway) and once Composer is installed, installing Drush is just a single command in the command line.

Install Composer on MacOSX

If you go to and click "Install" in the sidebar, you'll see that there is more than one way to install Drush. We're going to install one Drush for all projects, as it's the most common way to use Drush.

Let's start out by install Composer Globally on our Mac.

  • Click the "Install Composer globally" link (This page walks you through the commands you need to enter in order to install Composer globally.)
  • Copy the first command and paste it into your terminal and press Enter
  • Copy and paste the second command. (You'll likely need to run the command preceded by "sudo" due to permissions)
    • My installation doesn't have a "/usr/local/bin" directory, so I need to create that first.
    • I'll type "sudo mkdir -p /usr/local/bin" to create the directory and enter my password. (The -p creates directories recursively in case one or more in the chain don't already exist.)
    • Now, I'll retry the second command

And that's it! Now, when I type "composer --version" and press Enter, we'll see that I have version 1.0-dev installed!

Install Drush via Composer

Now, we're ready to install Drush with composer. It's pretty simple. In fact, it's a single line in the command line.

Back on the Drush Install page, we'll see the commands used to install Drush 7 and Drush 8. We'll install Drush 7 in this video, as it's the current stable release, but if you're working with Drupal 8, you'll need to use the Drush 8 command since Drupal 8 requires Drush 8.

  • In the command line, type "composer global require drush/drush:7.*" and press Enter.

If you get a popup to install the Xcode Developer tools, you can choose to install them, or not. I won't for this video, as they're not actually required.

Add Drush to the System PATH

Now, we need to add the new Drush installation to our sytem Path, so that we can run Drush from anywhere on our system. We'll add it in our user's .bash_profile file.

  • Type "vi ~/.bash_profile" to edit the file
  • Press the "i" key to enter Insert mode
  • Type "export PATH="$HOME/.composer/vendor/bin:$PATH"" (What this does is writes a new path for this user. It starts with the $HOME/.compser/vendor/bin directory, and then appends the existing path after that. Effectively adding the new folder to the beginning of our system path.)
  • Press the Escape (esc) key to switch back to command mode
  • Type ":wq" and press Enter to save and quit the file

Now we need to close this terminal window (and all other open terminals) to load the new path. Or, we can run the "source" command to load the .bash_profile file without having to restart the Terminal.

  • Type "source ~/.bash_profile" and press Enter

Now if I type "drush" and press Enter, you'll see that Drush is installed, and working on this machine. And when I type "drush status" and press Enter, you'll see that I have Drush version 7.0.0 installed!