Install a global Drush via Composer

Follow the instructions below:

  1. Install Composer globally.
  2. Install the cgr tool following the instructions in that project.
  3. Add composer's bin directory to the system path by placing export PATH="$HOME/.composer/vendor/bin:$PATH" into your ~/.bash_profile (Mac OS users) or into your ~/.bashrc (Linux users).
  4. Install latest stable Drush: cgr drush/drush.
  5. Verify that Drush works: drush status

Please do not install Drush using composer global require. See Fixing the Composer Global command for more information.

Notes

  • Update to latest release (per your specification in ~/.composer/composer.json): cgr update drush/drush
  • Install a specific version of Drush:

    # Install a specific version of Drush, e.g. Drush 7.1.0
    cgr update drush/drush:7.1.0
    
    # Install 8.x branch as a git clone. Great for contributing back to Drush project.
    cgr drush/drush:8.x-dev --prefer-source
    
  • Alternate way to install for all users via Composer:

    COMPOSER_HOME=/opt/drush COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/opt/drush/8 composer require drush/drush:^8
    
  • Documentation for composer's require command.

  • Uninstall with : cgr remove drush/drush

Windows

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). * 7.0.0 (stable). * 6.6.0. * 6.0.
  • 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 running Drush rsync and Drush sql-sync commands.