To install Drush globally for a single user follow the instructions below, or watch a video by Drupalize.me.
- Install Composer globally.
- Add composer's
bin
directory to the system path by placingexport PATH="$HOME/.composer/vendor/bin:$PATH"
into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users). - Install latest stable Drush:
composer global require drush/drush
. - Verify that Drush works:
drush status
-
Update to latest release (per your specification in ~/.composer/composer.json):
composer global update
-
Install a specific version of Drush:
# Install a specific version of Drush, e.g. Drush 7.1.0 composer global require drush/drush:7.1.0 # Install master branch as a git clone. Great for contributing back to Drush project. composer global require drush/drush:dev-master --prefer-source
-
Uninstall with :
composer global remove drush/drush
If you need Drush installed for all users on a system using Composer, install Composer globally then follow the steps below.
Important: Run these shell commands as a privileged user with write access to /opt
and /usr/local/bin
or prefix with sudo
.
# Create and/or navigate to a path for the single Composer Drush install.
mkdir --parents /opt/drush-8.x
cd /opt/drush-8.x
# Initialise a new Composer project that requires Drush.
composer init --require=drush/drush:8.* -n
# Configure the path Composer should use for the Drush vendor binaries.
composer config bin-dir /usr/local/bin
# Install Drush.
composer install
Use composer to update Drush just as you would with any other composer managed project. The vendor binaries will be updated for all users.
# Navigate to the Drush install path.
cd /opt/drush-8.x
# Run composer update
composer update
If upgrading to a new major version the steps are the same, with one addition:
# Remove the existing symlinks to Drush vendor binaries.
find /usr/local/bin -lname '/opt/drush*' -exec unlink \{\} \;
# Follow the steps shown above, starting with creation of a new path.
mkdir --parents /opt/drush-9.x
cd /opt/drush-9.x
Important: At the time of writing composer will warn you if it cannot create vendor binaries due to a name conflict with an existing file.
Drush on Windows is experimental, since Drush's test suite is not running there (help wanted).
- Acquia Dev Desktop is excellent, and includes Drush. See the terminal icon after setting up a web site.
- Or consider running Linux/OSX via Virtualbox. Drupal VM and Vlad are popular.
- These Windows packages include Drush and its dependencies (including MSys).
- Or install LAMP on your own, and run Drush via Git's shell, in order to insure that all depedencies are available.
- 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 runningdrush rsync
anddrush sql-sync
commands.