Skip to main content

How to Install Drush Using Composer

What is Drush?: Drush is the command line shell and Unix scripting interface for Drupal. The most common way to install Drush is to install it on a per-project basis using Composer. 


How to Install Drush

Recommended to install Drush on a per-project basis. This allows for having different versions of Drush installed for different projects. This is a best practice because different versions of Drush are compatible with a particular set of Drupal versions.

Here how to instal Drush in composer

composer require --dev drush/drush

Once completed run the command to verify it worked. The command is

./vendor/bin/drush --version

The result is like this (for example)

./vendor/bin/drush --version
# > Drush Commandline Tool 13.3.1.0

Using the Drush command

Run the drush from the root directory of your Drupal project.

In server environment, using the full path to the executable. For example, running ./vendor/bin/drush <command> from the root directory of your Drupal project

In other local environments, you may need to configure your $PATH environment variable to include ./vendor/bin, to avoid having to type the full path every time.


Resource: https://drupalize.me/tutorial/install-drush-using-composer

Google AdSense
client = ca-pub-2898279488603899
slot = 9058461004
format = auto