You are here

Installing Drush 9 using Composer

I've recently come across this problem a few times while talking to friends and collegues. It seems people are still using Homebrew or other strange methods to try and get Drush installed locally. This is especially frustrating for people looking to get started with Drupal 8 development as it requires the latest version of Drush. Using Composer is far and away the easiest method to install Drush.

First install Composer globally.

$ curl -sS | php
$ mv composer.phar /usr/local/bin/composer

Now add Composer's directory to your path by editing your .bash_profile or .zshrc

$ export PATH="$HOME/.composer/vendor/bin:$PATH"

Reload your terminal or just re-source the configuration you just added.

$ source ~/.bash_profile

Now that you have Composer working, you can install Drush from the latest HEAD.

$ composer global require drush/drush:dev-master

That's it!

Some other things you can do...

Keep Drush (and anything else you have installed with Composer) up to date.

$ composer global update

Roll back to a release version of Drush 8

$ composer global require drush/drush:8.*

Install a specific version of Drush. For example: Drush 6.1.0

$ composer global require drush/drush:6.1.0

No really, we're done now.

You can now go back to doing whatever it is you were doing before you realized you needed to install Drush. :)

Submitted by brant on Thu, 05/29/2014 - 22:59