Install/Upgrade a global Drush

# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush
# Or use our upcoming release: php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush

# Test your install.
php drush core-status

# Make `drush` executable as a command from anywhere. Destination can be anywhere on $PATH.
chmod +x drush
sudo mv drush /usr/local/bin

# Optional. Enrich the bash startup file with completion and aliases.
drush init

Install a site-local Drush

In addition to the global Drush, it is recommended that Drupal 8 sites be built using Composer, with Drush listed as a dependency.

  1. When you run drush, the global Drush is called first and then hands execution to the site-local Drush. This gives you the convenience of running drush without specifying the full path to the executable, without sacrificing the safety provided by a site-local Drush.
  2. Optional: Copy the examples/drush.wrapper file to your project root and modify to taste. This is a handy launcher script; add --local here to turn off all global configuration locations, and maintain consistency over configuration/aliases/commandfiles for your team.
  3. Note that if you have multiple Drupal sites on your system, it is possible to use a different version of Drush with each one.

Drupal Compatibility

Drush Version Drush Branch PHP Compatible Drupal versions Code Status
Drush 9 master 5.6+ D7, D8
Drush 8 8.x 5.4.5+ D6, D7, D8
Drush 7 7.x 5.3.0+ D6, D7
Drush 6 6.x 5.3.0+ D6, D7 Unsupported
Drush 5 5.x 5.2.0+ D6, D7 Unsupported