5

By following the instructions on the Drush git page:

composer global require drush/drush:6.*

I have Drush up and running (it seems to live in /root/.composer/vendor/drush/drush). But I imagine I shouldn't be running it via root. So how do I run it as my ordinary shell users?

When I try running drush it says command not found. Although it lets me use Composer. I tried installing Drush again through Composer while logged in as ordinary user without any luck. The Drush folder is also inaccessible..

2
  • 1
    Have you read the installation docs? I'm 99% certain this is covered
    – Clive
    Commented Jun 9, 2014 at 17:47
  • I fixed it just now.. the PATH to composer's bin was incorrectly added, when I added it for the logged-in-user it started working. At least I think it was that, because .composer and .drush directories suddenly appeared in my home directory.
    – KlineAl
    Commented Jun 9, 2014 at 18:02

1 Answer 1

7

To install for all users on the server:

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
ln -s /usr/local/bin/composer /usr/bin/composer

git clone https://github.com/drush-ops/drush.git /usr/local/src/drush
cd /usr/local/src/drush
git checkout 7.0.0-alpha5  #or whatever version you want.
ln -s /usr/local/src/drush/drush /usr/bin/drush
composer install
drush --version

Personally I don't bother making the composer symlink from /usr/local/bin to /usr/bin and made the drush symlink to /usr/local/bin (rather than /usr/bin) as I have /usr/local/bin in my $PATH but YMMV...

Source: http://docs.drush.org/en/master/install/

4
  • This is strange. Why do we need to use git clone at all? Is there no way to do this with compser require, or by adding a line in composer.json? This is what most tutorials / online instructions say, except that they will all give you drush in user home directory.
    – donquixote
    Commented Oct 23, 2017 at 20:53
  • @donquixote - AFAIK you nailed it when you said "except that they will all give you drush in user home directory"! I am not aware of any way to explicitly install it to a specific location as my answer does. TBH, I'm not sure why, but I've always assumed that it's a limitation of composer itself?! Commented Oct 24, 2017 at 3:08
  • stackoverflow.com/questions/33380480/… maybe this helps
    – donquixote
    Commented Oct 24, 2017 at 15:19
  • Interesting... Personally, I'll still continue to use the above as I like to keep custom global binaries limited to /usr/local because IMO it's much cleaner. A quick read of the drush docs suggest that they now have a tool that allows all users to globally use drush from within a composer project, so it sounds like what you want is totally possible with current drush. IMO though, it's better to do it right (even if it requires an extra line), rather than work around the issues created by doing it hacky in the first place. But that's only my opinion... Commented Oct 26, 2017 at 1:57

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.