If you are playing around with Drupal 8, you may want to install version 8 of Drush on your computer. However, Drush 8 is currently only available as the master branch at github, and you may not like to throw out your existing Drush 6 or 7 in favor of the Drush development version, which is not stable. I’d like to share with you a way you can have both installed at the same time. I used a Mac, though these commands should work well also under Linux. They will obviously not work on Windows.

1. Clone Drush master branch from git

We want to get the master branch from the Drush github repository. This will be placed under “usr/local/lib” as a new folder named “drush”. Launch your Terminal and type:

> cd /usr/local/lib/

> git clone --branch master https://github.com/drush-ops/drush.git

2. Get composer

Drush 8 requires composer to install, so you need to get that if you don’t have it already. We also want to move composer to /usr/local/bin/ so that it’s easier to use.

> curl -sS https://getcomposer.org/installer | php

> mv composer.phar /usr/local/bin/composer

3. Install Drush

We can now install Drush through Composer. At the end, Composer will generate some autoload files, though you can ignore the suggestions.

> cd drush

> composer install

4. Create an alias for Drush 8.

To make Drush 8 a bit easier to access, we can create an alias that you can use in the Terminal. Type:

> vi ~/.bash_aliases (Linux)

> vi ~/.bash_profile (Mac)

This will open the “vi” text editor. To move around, use your cursor keys. Type “i” to edit the text. When you’re done, type “esc” followed by “:wq” to save and close the editor. Inside this file, we want to add:

alias drush8='/usr/local/lib/drush/drush'

5. Go ahead and unleash the power of Drush 8

Now it’s time to test that everything we did works well. Type:

> drush8 version

It should return this text:

Drush Version : 8.0-dev

Your Drush 6 or 7 will still be there and untouched by this installation. Enjoy!

So what’s new in Drush 8?

Drush 8 adds the following commands to your default arsenal: browse, core-cli (php), image-derive (id), cache-rebuild (cr, rebuild), config-export (cex), sql-sanitize (sqlsan). Some of them are Drupal 8 specific. I’ll write about these commands in a future blog post.