I installed Drush 8 with composer.

composer require drush/drush:~8

Unfortunately, error drush command not found after Drush completely installed.

Why's the drush command can't be use?

enter image description here

Installing Drush for Drupal 8 with Composer


  • Assuming your php is 5.4.5 or grater, I wonder if this "Build Failing" has something to do with your problem.
    – No Sssweat
    Jul 11, 2016 at 3:47
  • @NoSssweat Thanks. How do I remove it? Is that remove the composer.json?
    – JJ12345
    Jul 11, 2016 at 3:51
  • 1
  • Then try installing Drush 9 master/dev.
    – No Sssweat
    Jul 11, 2016 at 3:55
  • 1
    composer global require drush/drush:dev-master
    – No Sssweat
    Jul 11, 2016 at 3:56

5 Answers 5


Once you have installed Drush, you need to ensure that you ~/vendor/bin directory is in your $PATH, as explained in the installation instructions (Note: this link no longer works)

Add export PATH="$HOME/.composer/vendor/bin:$PATH" to your ~/.bash_profile or ~/.bashrc, and then run source ~/.bash_profile (or ~/.bashrc).

I would recommend against installing Drush 9 via composer require at this time. Sticking with Drush 8 is probably best; if you want to use Drush 9, use a simpler installation method, such downloading the .phar, or clone the repository and run composer install in the directory Drush was cloned to.

  • 1
    I would recommend against installing Drush 9 via composer require at this time. Thanks for the info!
    – No Sssweat
    Jul 11, 2016 at 4:31
  • 1
    What is the reason to against installing Drush 9 via composer require ?
    – Jimmy Ko
    Jul 24, 2016 at 3:09
  • 1
    The non-stable version of Drush requires some non-stable versions of its dependencies. This can cause some complications, depending on what you are doing. Generally you get around this by setting your minimum stability, but it's simpler to just install via another method. As an aside, if you are inclined to use composer global require for anything, please see github.com/consolidation-org/cgr Jul 24, 2016 at 22:00
  • @JimmyKo The reason that a global Drush isn't recommended is that with Drush 9+, best practices recommend Drush to be installed as a dependency for Drupal. This prevents issues with a Drush version mismatch, for example.
    – karolus
    Oct 7, 2018 at 23:34
  • If it still doesn't work, ` ~/.bash_profile` or ~/.bashrc might have been edited. Back it up and find a default one. Apr 2, 2019 at 3:38

Using ssh on my server host I did add drush to my path following composer instructions: Add

    export PATH="$HOME/.composer/vendor/bin:$PATH"

to your ~/.bash_profile or ~/.bashrc, and then run source ~/.bash_profile (or ~/.bashrc)

However, I got this running

    drush status
    -bash: drush: command not found

    which composer

    which drush   
    /usr/bin/which: no drush in (/home/mth/.composer/vendor/bin:/home/mth/.composer/vendor/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/mth/bin:/home/mth/bin)

Using my cPanel file manager, I found I couldn't see the hidden composer folder, though I saw other hidden folders and files (dot prefix). It turns out composer was within the .config folder. I added the new folder to my $PATH and bingo!

    export PATH="$HOME/.config/composer/vendor/bin:$PATH"   

Hours! Moral? Verify composer location.

  • 1
    Thanks for the code export PATH="$HOME/.config/composer/vendor/bin:$PATH" code. It help me solve my problem. Aug 5, 2020 at 6:18
  • OMG...I spent 2 hours trying to figure this out because of this. I can't believe how blind I was...but THANK YOU.
    – Doomd
    Sep 9, 2020 at 19:07
  • helped on shared server
    – esQmo_
    Jan 23, 2021 at 13:33

Anyone on Ubuntu 20.04?

I noticed composer installs not in ~/.composer/vendor/bin, but ~/.config/composer..

Super weird, since nobody has mentioned that (important) fact.

I am sure with the proper path sourced, it will work now..

I changed my $PATH in ~/.bashrc to ~/.config/composer/vendor/bin like this: export PATH="$HOME/.config/composer/vendor/bin:$PATH"

..and it works!

  • Yeah the path should be export PATH="$HOME/.config/composer/vendor/bin/:$PATH" , I found it so late :( Jul 18, 2021 at 7:41

You need to make sure that drush is located within your environmental PATH variable, or you can specify installation folder by setting COMPOSER_BIN_DIR, e.g.:

sudo COMPOSER_HOME=/var/lib/composer COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/var/lib/composer/vendor composer require drush/drush:~8

Or it's much easier to install it via Phar, e.g. on Linux:

sudo install <(curl http://files.drush.org/drush.phar) /usr/local/bin/drush

On OS X, try: brew install drush.


Now, although my issues were with a Composer Scaffold install for Drupal 8 which needs Drush (in this case v.9) installed as a dependency, I too was having similar issues. Even though a global Drush is no longer recommended, due to dependency issues, it's very convenient to call upon Drush from anywhere.

What I would recommend installing is Drush Launcher, which will give you the option of calling Drush from anywhere, even if you are running different projects using different versions of Drush. I have it running both locally and on my Web servers, and it's running fine there. It fixed my issues of seeing drush: command not found, even when I had projects where Composer had correctly installed Drush.

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.