sexta-feira, 26 de agosto de 2022

How to install Drush globally for Drupal?

Install drush in your Drupal 9 installation: 

composer require drush/drush

After that you can use drush in directory /vendor/bin/drush. But if you want to use drush in any directory, you must use Drush Launcher. 

Basically, run this command to download drush.phar: 

curl -OL https://github.com/drush-ops/drush-launcher/releases/latest/download/drush.phar

Then config the permission: 

chmod +x drush.phar

After that, move the file to the location listed on your path:

sudo mv drush.phar /usr/local/bin/drush

If you need to update drush launcher, run this code: 

drush self-update