Introducing Drush 8

Greg Anderson , Open Source Contributor Reading estimate: 4 minutes

DrupalCon LA was a complete blast. In addition to exciting announcements, amazing sessions and tons of fun side events, there were also a lot of super productive sprints that really pushed Drupal development forward. In the Drush sprints, the remaining issues tagged for Drush 7 were all reviewed, and either resolved or deferred, cumulating in the release of Drush 7.0 Stable today. During the twenty-month development cycle of this release, most of the bug fixes and new features not related to Drupal 8 were backported to the Drush 6 branch. Users of Drush 6 therefore will not notice a huge difference with the release. However, this release is all the same momentous, and introduces some important changes that all Drush users should be aware of, particularly those who are using, or intend to use Drupal 8.

Drush 7 No Longer Supports Drupal 8

The most important change to be aware of is that support for Drupal 8 has now been dropped in Drush 7. The “master” branch in Drush’s git repository was relabeled “Drush 8” in Drush’s composer.json file, and a new “7.x” branch has been created for continuing development on Drush 7 releases. As was previously explained in the article What Version of Drush Works with Drupal 8?, since Drupal 8 is not yet stable, it is not possible for a stable release of Drush to support future version of Drupal 8, as changes made during its development regularly require corresponding changes inside Drush. So, moving forward, Drush 7.0-rc2 will continue to support Drupal 8.0-beta10, but Drush 8 will be required for the next Drupal 8 release. If you try to use Drush 7.0 stable with Drupal 8, you will receive an error message.

Upgrade Instructions for Drupal 8 Users

So, what is a Drupal 8 user supposed to do? The solution is not to keep using Drush 7.0-rc2 forever! This may or may not work with Drupal 8.0-beta11, but sooner or later, you will start to encounter failures. The only solution is to upgrade to Drush 8. How you do that depends on how you installed Drush.

Git Users

If you checked out the master branch of Drush from git, then your upgrade path is very easy — simply run git pull, and you will find that Drush is now reporting that it is version 8.x-dev instead of 7.x-dev.  Remember, when using git to fetch Drush, you need to run Composer install from Drush’s root directory immediately after you clone it, and again any time the composer.lock file changes.

Composer Users—Drush Required in Drupal’s composer.json

Composer users who include a site-local Drush in the composer.json for their Drupal site, as recommended by drupal-composer/drupal-project, were formerly advised to require Drush 7, as follows:

   "require": {
     "composer/installers": "^1.0.20",
     "drupal/core": "8.0.*",
     "drush/drush": "7.0.x-dev",

     "drupal/devel": "8.1.*@dev",
     "drupal/token": “8.1.*@dev"
   }


Now, the highlighted line should be updated to read "drush/drush": “8.*".

This change has been made in the drupal-project GitHub repository; you’ll need to make a similar change in your Drupal 8 composer.json file. Note that this only applies to users who are building their Drupal 8 site with Composer; if you are downloading and installing Drupal 8 without Composer, you do not need to modify Drupal’s composer.json file.

Composer Users Downloading Stable Versions of Drush

If you downloaded drush following the instructions in the Drush Installation Instructions, via Composer global require drush/drush:7.*, you can upgrade with Composer by typing:

    composer global require drush/drush:8.*

If you installed by some other means, you should first remove your older Drush, or simply take it off of your global $PATH, before installing via Composer. See the Drush Installation instructions for information on how to manage your $PATH.

Pantheon Users

If you are using Drupal 8 remotely on Pantheon, then you are already covered.  The version of Drush installed on Pantheon is compatible with the current version of Drupal 8, and Drush will be upgraded to version 8 when the next version of Drupal 8 is released.  On your local system, Drush 6 and 7 will have no trouble making remote calls to Drush 8, so there is nothing that you need to do if you have no local copies of Drupal 8 installed.

If you have not tried Drupal 8 yet, spinning up a copy on a free Pantheon development site is a super easy way to get started.  You can set that up by visiting the following URL:

    https://dashboard.getpantheon.com/products/drupal8/spinup

If you are using Drupal 8 remotely on some other ISV that supports it, it should also still work; if you have problems, though, open a support ticket with your provider and include the URL to this blog post.

Upgrade Planning for Drupal 7 Users

Should Drupal 7 users upgrade to Drush 7? Absolutely! Drush 7 manages its dependencies with Composer, and uses a modernized bootstrap process designed to be more flexible, making it easier to integrate with new systems such as Drupal 8 and Backdrop. While most users will not be able to see, feel or taste these changes, it is still important to plan an upgrade to Drush 7 at some point in the not-too-distant future. Now that Drush 7 is the recommended stable release, fewer features and bug fixes will be backported to the Drush 6 branch. In order to keep up with future development, you will want to move to the Drush 7 branch.

All in all, you should find that the Drush 7 API and commandline options are very similar to what existed in Drush 6, so most users should find the upgrade process fairly painless. If you need help, post a question on Drupal Stack Exchange; if you find any bugs, they can be reported in the Drush Issue Queue.

Discover More

Halting DDoS Attacks: Effective Strategies for Prevention

Conor Bauer
Reading estimate: 9 minutes

How to Build Agile Web Development Practices For City Government

Steve Persch
Reading estimate: 5 minutes

Drupal for Civic Engagement: the City of Chattanooga Story

Yulia Popova
Reading estimate: 3 minutes

Try Pantheon for Free

Join thousands of developers, marketers, and agencies creating magical digital experiences with Pantheon.