March 21, 2016

If you run into problems using Drush with Drupal 8 you probably need to upgrade Drush.

I received this message - Error: Class 'Drupal\Core\Session\AccountInterface' not found, and found the instructions from http://docs.drush.org/en/master/install-alternative/ and http://docs.drush.org/en/master/install helpful.

Upgrading Drush

1. Install Composer globally

$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer

2. Add Composer's directory to your path by editing your .bash_profile or .zshrc

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

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

$ source $HOME/.bashrc

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

$ composer global require drush/drush:dev-master

Source

Removing Conflicts from Existing Drush Dependencies

I ran into some problems due to previous Drush dependencies.

I had Drush 7 installed, and its dependencies caused failures when installing Drush 8 with Composer. I removed the conflicts with the following commands:

$ composer global remove drush/drush
$ composer global remove package/package

Additional Drush Upgrade Instructions 

Here are a few alternative installation instructions you may find useful:

Install Drush 8 With Composer

Installing Drush 8 and Drush 7 Simultaneously