Install Drush 7 With Composer

Last modified: 
Sunday, March 29th, 2015

Drupal 8 requires Drush >= 7 to work properly. If you try to use Drush 6 with Drupal 8, you'll get errors like this

PHP Fatal Error: Class 'Drupal' not found in .../core/includes/ on line 178

You can install Drush using Composer. The following example assumes you are ssh'd into a Vagrant box and Composer is installed.

Install Drush with Composer

sudo composer global require drush/drush:dev-master

This will install the latest Drush 7.0-dev release (or whatever is most current).

Add a symlink

Here's the part that assumes you're in a Vagrant machine. You can adjust this to reflect your own environment or even add the path to your $PATH variable in ~/.bashrc.

sudo ln -s /home/vagrant/.composer/vendor/bin/drush /usr/bin/drush

Check your work

# This should return something like 
# Drush Version    :    7.0-dev
drush version

The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.