Install drush globally using composer on WSL

With reference to my previous post, Setup development environment for Drupal on Windows 10, I noticed that installing drush on WSL using composer does not work by default. In this post I am going to demonstrate how to install drush globally using composer on WSL.

I am assuming you have composer installed. In order to install Drush, we have to follow the below mentioned steps.

composer global require drush/drush

Now check drush installed path by running below command.

composer config --global home

This will print the path for Drush currently installed, i.e., /home/my-user-name/.config/composer. Now we have to set this in PAHT so that the Drush command can be run from anywhere, using the below command. Replace my-user-name with your own.

echo 'export PATH="/home/my-user-name/.config/composer/vendor/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Now check that the drush command is working by running drush

0/5