Drupal - Does drush need to be installed as root?

NOTE The issue described in the Question has now be fixed in the latest Drush version.

No, Drush does not need to be installed as root.

I've submitted Drush pull #2246 to update the current Drush install instructions.

This install method fixes the issue as per Drush pull #2246:

# Download latest stable release using the code below or browse to github.com/drush-ops/drush/releases.
php -r "readfile('http://files.drush.org/drush.phar');" > /tmp/drush
# Or use our upcoming release: php -r "readfile('http://files.drush.org/drush-unstable.phar');" > /tmp/drush

# Test your install.
php /tmp/drush core-status

# Make `drush` executable as a command from anywhere. Destination can be anywhere on $PATH.
chmod +x /tmp/drush
sudo mv /tmp/drush /usr/local/bin

# Optional. Enrich the bash startup file with completion and aliases.
drush init

Not sure exactly what's going on there but I can reproduce it using the installation instructions.

The problem is related to the execution path (haven't looked any deeper). If you move out of the folder you downloaded drush into and execute, it'll work. (cd ~/..; Michael/drush core-status).

That's probably why it works when you su - your working directoy changes to /root. An unfortunate red herring, the problem doesn't appear to be related to permissions at all. Had you run sudo php drush core-status, it still wouldn't have worked.

Tags:

Installing