6

I'm trying to install drush 8 via composer:

composer global require drush/drush:dev-master (source)

but it gives me drush version 7.0.0 which is without D8 integration... I'm using Linux Mint 17.

2
  • 1
    Just saying: dev-master used to be drush 8, but I think now it is drush 9. Which is unsuitable for Drupal 7. Maybe this needs an update?
    – donquixote
    Commented Oct 23, 2017 at 20:47
  • At this point in time, the accepted answer will give you Drush 9. If you want Drush 8 specifically, you must specify that in the composer syntax. See this answer: drupal.stackexchange.com/a/257020/1441
    – user1359
    Commented Oct 23, 2019 at 13:08

3 Answers 3

3

composer require drush/drush:dev-master gave me Drush 8 three days ago when I ran this tutorial to setup different versions of Drush on my system http://www.jpstacey.info/blog/2014-04-07/switching-between-drush-major-versions

Multiple versions of Drush can be useful if a site is no longer in development and for example custom drush commands were created for a specific version of Drush.

2
  • Not work for me too, but marked as accepter. I've ended using vagrant VDD box for D8
    – Codium
    Commented Aug 3, 2015 at 10:39
  • 5
    dev-master will install beyond Drush 8 now (Drush 9 at time of writing). From my experience, Drush 9 appears to be incompatible with Drupal 7 also mentioned here. So if you want Drush 8 (or 8.1) which does work with Drupal 7 then do composer require drush/drush:~8 - see: drupal.stackexchange.com/a/200547/1082 Commented Jan 31, 2018 at 17:16
6

For Ubuntu

export PATH="$HOME/.composer/vendor/bin:$PATH"
source $HOME/.bashrc
composer global require drush/drush:8.x
2
  • This line worked for me on Mac: composer global require drush/drush:8.x Thanks!
    – BassPlaya
    Commented Mar 7, 2020 at 5:35
  • For me the path is different and is like this export PATH="$HOME/.config/composer/vendor/bin/:$PATH" Commented Jul 18, 2021 at 7:40
1

I also find that composer require drush/drush:dev-master (n.b. deliberate removal of global option), ran in a directory without a composer.json file did in fact pull down the 'master' branch of Drush, which is Drush 8, just as the documentation says. As an experiment, you might want to try running the same command (without global) in an empty directory, and see if you get the right version of Drush in that instance.

If that is working for you, then perhaps you have an older version of Drush in your global vendor directory ($HOME/.composer/vendor/drush/drush). It is possible that Composer might become confused by this, as 'dev-master' did at one time refer to the 7.x branch. I did not attempt to reproduce this situation, and tend to think that in most cases you should still get the 'master' branch. However, if you are having trouble, you might try composer global remove drush/drush, and then re-install as you did before, and see if this fixes the problem. You might also try composer self-update, in case you have an old composer.

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.