# Install a specific version of Drush, e.g. Drush 6.1.0 composer global require drush/drush:6.1.0 # Master branch as a git clone. Great for contributing back to Drush project. Composer global require drush/drush:dev-master -prefer-source. The dispatcher will automatically register the subscriber for each event returned by the getSubscribedEvents method. This method returns an array indexed by event names and whose values are either the method name to call or an array composed of the method name to call and a priority (a positive or negative integer that defaults to 0). Install Drupal Console Using Composer. Change directory to Drupal site: cd /path/to/drupal8.dev Execute composer require command: composer require drupal/console:1.0 -prefer-dist -optimize-autoloader. A useful example would be for a Drupal multisite setup where the package should be installed into your sites subdirectory. This is only applicable to packages.
Pick a version
Each version of Drush supports multiple Drupal versions. Drush 7 is current stable Drush.
|Drush Version||Drush Branch||PHP||Compatible Drupal versions||Code Status|
|Drush 9||master||5.5+||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|
|Drush 4||4.x||5.2.0+||D5, D6, D7||Unsupported|
|Drush 3||3.x||5.2.0+||D5, D6||Unsupported|
Pick an install method
The four sections below describe ways to install Drush. None is superior to the others.
Composer - One Drush for all Projects
- Optional - video instructions by Drupalize.me.
- Install Composer globally.
To install Drush 7.x (stable):
To install Drush 8.x (dev) which is required for Drupal 8:
Now add Drush to your system path by placing
export PATH='$HOME/.composer/vendor/bin:$PATH'into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).
To update to a newer version (what you get depends on your specification in ~/.composer/composer.json):
Alternate commands to install some other variant of Drush:
To install for all users on the server:
- If Drush cannot find an autoloaded class, run
composer self-update. Drush often tracks composer changes closely, so you may have some problems if you are not running a recent version.
- If composer cannot find a requirement, and suggests that The package is not available in a stable-enough version according to your minimum-stability setting, then place the following in
Merge this in with any other content that may already exist in this file.
See Configure for next steps.
Composer - One Drush per Project
- If your web site is built from a composer.json file (see https://github.com/drupal-composer/drupal-project), add the following to the
composer installfor a new project or
composer updatefor an existing one. Do so from the same directory as composer.json.
- Optional: Copy the /examples/drush file to your project root and modify to taste. This is a handy launcher script.
- To update, change the drush/drush line and run
Git Clone (i.e. manual install)
- Place the uncompressed drush.tar.gz, drush.zip, or cloned git repository in a directory that is outside of your web root.
Make the 'drush' command executable:
$ chmod u+x /path/to/drush/drush
Configure your system to recognize where Drush resides. There are 3 options:
Create a symbolic link to the Drush executable in a directory that is already in your PATH, e.g.:
$ ln -s /path/to/drush/drush /usr/bin/drush
Explicitly add the Drush executable to the PATH variable which is defined in the the shell configuration file called .profile, .bash_profile, .bash_aliases, or .bashrc that is located in your home folder, i.e.:
Add an alias for drush (this method can also be handy if you want to use 2 versions of Drush, for example Drush 5 or 6 (stable) for Drupal 7 development, and Drush 7 (master) for Drupal 8 development). To add an alias to your Drush 7 executable, add this to you shell configuration file (see list in previous option):
$ alias drush-master=/path/to/drush/drush
For options 2 and 3 above, in order to apply your changes to your current session, either log out and then log back in again, or re-load your bash configuration file, i.e.:
$ source .bashrcJuststreamanime.
Test that Drush is found by your system:
$ which drush
From Drush root, run Composer to fetch dependencies.
$ composer install
See Configure for next steps.
Windows Zip Package
Windows support has improved, but is still lagging. For full functionality, consider running Linux/Unix/OSX via Virtualbox, or other virtual machine platform. The Vlad virtual machine is popular.
These Windows packages include Drush and its dependencies (including MSys).
- 7.0.0 (stable).
Unzip the downloaded file to anywhere thats convenient on your system.
Whenever the documentation or the help text refers to
drush [option] <command> or something similar, 'drush' may need to be replaced by 'drush.bat'.
Most Drush commands will run in a Windows CMD shell or PowerShell, but the Git Bash shell provided by the Git for Windows installation is the preferred shell in which to run Drush commands.
Composer Require Drupal/smtp
When creating site aliases for Windows remote machines, pay particular attention to information presented in the example.aliases.drushrc.php file, especially when setting values for 'remote-host' and 'os', as these are very important when running Drush rsync and Drush sql-sync commands.