I am having problems installing drush 8 in ubuntu 16.04. when i insert the following command in the terminal

composer global require drush/drush:dev-master

i get the following error enter image description here

I have also tried the documentation from drush.org

php -r "readfile('https://s3.amazonaws.com/files.drush.org/drush.phar');" > drush

but i get the following error msg

bash: drush: Is a directory

I am currently stuck.

  • To show error messages, please copy-paste the text. Don't use screenshots for text.
    – apaderno
    Aug 14 '16 at 5:22
  • @kiamlaluno This question is originally not asking the same thing as the old post. It is the further question after solving the original question. So I think it should not be marked as duplicate.
    – Jimmy Ko
    Aug 14 '16 at 23:49
  • @JimmyKo Actually, the first revision didn't even contain an explicit question, nor did it contain any useful details. It was edited after I closed it, but the edit invalidates the given answers, so it needs to be reverted.
    – apaderno
    Aug 15 '16 at 21:15

drush/drush:dev-master is not Drush 8, it is Drush 9. To install Drush 8, try composer global require drush/drush, or better yet, use cgr.

For notes on installing Drush 9 via Composer, please see drush dev-master requires codegyre-robo.

  • I am getting the following error "Your requirements could not be resolved to an installable set of packages." when i ran this "composer global require drush/drush"
    – Ian Nato
    Aug 14 '16 at 18:09
  • 1
    composer global require can fail if you install two global applications that conflict with each other. To resolve this problem, use cgr (github.com/consolidation-org/cgr). Aug 14 '16 at 22:02

You have to use sudo.

sudo composer global require drush/drush:dev-master

The composer is to install the drush at /usr/local/share which folder's owner is root. In Ubuntu, sudo is a must for granting the root privilege.

And, as what @greg_1_anderson said, dev-master is the branch for Drush 9, if you want Drush 8. Please use.

sudo composer global require drush/drush:8.x
  • I am getting the following error "Your requirements could not be resolved to an installable set of packages" when i run this sudo composer global require drush/drush:8.x
    – Ian Nato
    Aug 14 '16 at 18:00
  • I am getting the same error message as the one i posted as a problem when i ran this command "sudo composer global require drush/drush:dev-master"
    – Ian Nato
    Aug 14 '16 at 18:04
  • @IanNato It should be considered as new question because the original thing you are asking should be solved by using sudo. The new error message is indicating the other problem. You should use cgr as stated as @greg_1_anderson to fix the new error.
    – Jimmy Ko
    Aug 14 '16 at 23:51
  • 3
    You should not run composer with sudo because plugins have full access to the user account that runs composer and this is a security issue getcomposer.org/root
    – wranvaud
    Jul 30 '17 at 17:10
  • Installation passed, but when I try "drush --version" I get "-bash: /usr/bin/drush: No such file or directory"
    – MilanG
    Jan 18 '19 at 8:14

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