Last Updated: February 25, 2016
·
5.327K
· pbuyle

Install Drush via Composer

Since Drush is distributed as a PEAR package, it can be installed as project dependencies via Composer. This allow you to install Drush on a per-project basis, to ensure the proper version of is used. This is especially useful when using Drush in a build script run through a CI server such a Jenkins.

composer.json

{
  // ...
  "repositories": [
    {
      "type": "pear",
      "url": "pear.drush.org"
    }
  ],
  "config": {
    "bin-dir": "bin"
  },
  "require-dev": {
    "pear-drush/drush": "6.*"
  }
}

After running composer install Drush will be available in the bin directory in your project dir. In order to use it from you shell, you need to add your the bin direcotry to your path and set the DRUSH_PHP environement variable. This can be done running the following commands from you project directory.

export PATH=`pwd`/bin:$PATH;
export DRUSH_PHP=`dirname $(which drush)`/composer-php;

1 Response
Add your response

If you run composer global install</code>, it will install it globally.

over 1 year ago ·