I have Drush 5.2 installed on my local dev system and my remote host, which has staging and production sites. I have aliases for all three sites, and am able to use rsync and sql-sync on both systems with no problems.

From what I understand, I'm should also be able to issue commands to the remote system such as

drush @stage vset preprocess_css 0

Whenever I try to do something like this, it fails. For instance, if I run drush -d @stage status, I get:

Bootstrap to phase 0. [0 sec, 3.7 MB]                                [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 3.93 MB] [bootstrap]
Loaded alias @stage from file /path/to/local/drupal/sites/all/drush/aliases.drushrc.php [0.01 sec, 3.94 MB]                          [notice]
Cache HIT cid: 5.2-commandfiles-0-c87dbef8e3e302e07ccdc024aee7fbbd [0.16 sec, 3.95 MB]                                                                      [debug]
Begin redispatch via invoke process [0.19 sec, 8.77 MB]                                                                                                    [notice]
Backend invoke: ssh -o PasswordAuthentication=no [email protected] 'drush  --invoke --debug                                                 [command]
--root=/path/to/remote/drupal/ --uri=http://stage.mysite.com --verbose status 2>&1' 2>&1 [0.23 sec, 8.8 MB]
executing ssh -o PasswordAuthentication=no [email protected] 'drush  --invoke --debug --root=/path/to/remote/drupal/      [notice]
--uri=http://stage.mysite.com --verbose status 2>&1' 2>&1 [0.23 sec, 8.8 MB]
Calling proc_open(ssh -o PasswordAuthentication=no [email protected] 'drush  --invoke --debug --root=/path/to/remote/drupal/ --uri=http://stage.mysite.com --verbose status 2>&1' 2>&1);
bash: drush: command not found
Invoke process is complete [1.34 sec, 8.79 MB]  

1 Answer 1


In order for remote commands to work, you must make sure that drush is in your PATH. This is often done by putting something like the following in a line that bash will source when it starts up:

export PATH=$PATH:$HOME/local/drupal/drush

A lot of folks put a line like this in their ~/.bashrc file, but note that on a lot of systems, this file begins with a line similar to the following:

[ -z "$PS1" ] && return

This means that everything below the line above will only execute when bash is running interactively; if you put drush in your PATH after this point, you will be able to run drush when you log in to your remote machine, but not when you attempt to call drush remotely (e.g. via drush, as shown above).

There are many solutions to this problem.

  1. Set your PATH before .bashrc bails out.

  2. Make a symbolic link to your drush executable from a directory that is always in your PATH (e.g. sudo ln -s /path/to/drush /bin)

  3. Set %drush-script as described in examples.aliases.drushrc.php.

  • 1
    P.S. Please upgrade to Drush 5.4. :) Jun 25, 2012 at 21:55
  • Thanks, Greg. There was already a symlink in bin, but for some reason that didn't work for the remote commands. Neither did adding Drush to my PATH in .bash_profile. But for some reason, adding it in .bashrc did. Also upgraded to 5.4 :) Jun 25, 2012 at 23:33

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.