I have installed Drupal 8.5 using composer create-project drupal-composer/drupal-project:8.x-dev my_site_name_dir --stability dev --no-interaction.

This command installs many files. I found drush-files in the root and the file vendor/drush. It looks like Drush is available, but I have no idea how I can run drush. Trying command like "drush cr" was not successful. I get the following error.

-bash: drush: command not found.

I don't want to be able to use Drush from everywhere.

How can I use Drush only from my_site_name_dir?

  • Did you try cding into the docroot (or web) folder and running ../vendor/bin/drush ? If that works, whats missing is an alias. I am not familiar with Drupal-Composer but some scaffolders like Acquia BLT do that part for you automagically. Did you also try restarting terminal?
    – Kevin
    Apr 14, 2018 at 16:22
  • @Kevin Yes I have tried with no success. But the alias was a good reference. I make one in my .bash_profile. And now it works for me.
    – lesley n.
    Apr 15, 2018 at 8:42
  • That's what Drush Launcher is for. A global drush command to always pick up a Composer-based project's local Drush. See drush.org/install
    – leymannx
    Nov 27, 2020 at 23:08

4 Answers 4


Basically, you need to follow steps on http://docs.drush.org/en/master/install and get Drush installed globally. It's possible to invoke Drush installed within Composer context together with Drupal 8 indicating the exact path something like /path-to-website-home/vendor/bin/drush. However, if you want Drush available anywhere in the system then get Drush Launcher installed.

Here is direct quote from http://docs.drush.org/en/master/install:

Optional. To be able to call drush from anywhere, install the Drush Launcher. That is a small program which listens on your $PATH and hands control to a site-local Drush that is in the /vendor directory of your Composer project. If you skip this step, run Drush from Drupal root via ../vendor/bin/drush. In that case Drush's bash integration and custom prompt won't work.

You might also want to read How to get Drush to work with Composer and What is the right way of installing Drupal 8?

  • I thought this was no longer advised and instead you should use Drush 9 and install it as a project dependency?
    – Kevin
    Apr 14, 2018 at 16:23
  • Drush 9 will work only with Drupal 8, but there could be Drupal 7 or 6 websites on the same server, so when you say I don't want to be able to use Drush from everywhere that means Drush work with all versions of Drupal and that's where Drush Launcher comes in to play as it automatically detects Drupal version of the current working directory and loads necessary Drush version environment.
    – AltaGrade
    Apr 14, 2018 at 18:21
  • Drush docs moved to drush.org/install
    – leymannx
    Dec 2, 2020 at 10:15

I got it by myself. There is no need to install drush globally. The composer command
composer require drush/drush
install all the necessary files for using drush. To make Drush run you need an alias to this file in your .bash_profile (mac users). I only add in the .bash_profile alias drush='vendor/drush/drush/drush'
And Drush works!
And there is also no need to have trouble with different drupal versions, because composer install the version you need.

  • I'm using Ubuntu 20.04 so I had to edit my ~./bashrc file and add a line at the end with alias drush='vendor/drush/drush/drush'
    – bwaindwain
    Jan 15, 2021 at 18:50
  • 1
    @bwaindwain that should actually be ~/.bashrc and is not just valid in Ubuntu
    – Jakke
    Apr 22, 2022 at 12:28

Just an addition for windows users.

lesley n. answer above works just fine for Windows users as well.

Just edit C:\Users\your_username\.bash_profile and add one line:

alias drush='vendor/bin/drush'

Restart your Git Bash, go to your drupal site home folder and try:

drush version

It should work

I was able to make composer-installed Drupal Console to work with only "drupal" command also with one line addition to C:\Users\your_username\.bash_profile as well:

alias drupal='vendor/bin/drupal'

Restart your Git Bash, go to your drupal site home folder and try:

drupal --version

This should work as well.

These two solutions are much easier for me than installing Drush Launcher and Console Launcher on my Windows platform.

Please, note that due to the relative alias paths this only works when you call drush and drupal commands from inside your project root.

  • That's what Drush Launcher is for. A global drush command to always pick up a Composer-based project's local Drush.
    – leymannx
    Nov 27, 2020 at 23:00
  • @leymannx Thank you for your concerns. I didn't install global Drush. I know that it is not supported any more. I have Drush installed with Composer as dependency for each of my project. And the above method works nice. If it works nice for everybody I see both Drush launcher and Console launcher as unneeded tools any more. Did you try the above method or are you posting recommendation for Drush launcher without trying above method? It is an important detail for others who read this discussion to know.
    – devad
    Nov 30, 2020 at 17:36
  • Ah, I see. You are referencing an relative path. It's actually quite clever, but the problem is this only works when you call drush from inside the project root. Maybe add that little bit of info.
    – leymannx
    Nov 30, 2020 at 20:48
  • Thnx @leymannx. I have added a note to the bottom of my post. BTW... why is it a problem? I have never used drush or drupal command outside of my project root anyway. Is there any reason why we need to use drush command outside of our project root sometimes? And, if yes... is this reason still valid now when global Drush installation is no more supported?
    – devad
    Dec 2, 2020 at 1:06
  • Of course this reason is valid, that's one of the reasons Drush Launcher exists. Imagine during development you cd web/themes/custom/MYTHEME && gulp build and then want to drush cr immediately thereafter. With Drush Launcher and a fallback Drush you can even run drush from outside a project again by passing the --root option to it.
    – leymannx
    Dec 2, 2020 at 8:17

Drush only supports one install method. It requires that your Drupal site be built with Composer and Drush be listed as a dependency.

That 👆 means after you added Drush via composer require drush/drush to your project you then call Drush via vendor/bin/drush cr or vendor/drush/drush/drush cr from inside the project root.

If you are working on many Drupal (7, 8 and 8+) projects or if you are simply preferring to call a global drush command like you are used to you can install the Drush Launcher and then only have to type drush cr again from anywhere inside the project. The Drush Launcher simply picks up the local Drush in each project. Which is especially nice when you have projects requiring different versions of Drush.

See the new docs for more info and for a Drupal Compatibility chart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.