Capistrano says, "sh: bundle: not found"

By: Johnathon Wright on: May 12, 2011

Typically, you define your path in /etc/environment. Here's a simple example:


That last bit tells the system where Ruby lives. If Ruby isn't in the path, you won't be able to run it or any gem scripts, like bundle.

Unfortunately, neither /etc/environment nor /etc/profile is respected under certain situations, like the way Capistrano works by default.

The solution for me was to edit /etc/bash.bashrc, adding this as the first line:

source /etc/environment

Note: Adding it as the first line allows / encourages it to be overwritten as needed. If you're still having problems, here's one way to get started with troubleshooting:

edit /etc/bash.bashrc to include this

export USES_BASHRC='bashrc'

edit /etc/profile to include this line:

export USES_PROFILE = 'profile'

then see whether either of those environmental variables is around when capistrano connects. From your dev machine, run "cap shell" and you will end up with a "cap>" prompt. type "echo $USESBASHRC && echo $USESPROFILE. Here's what I got:

cap> echo $USESBASHRC && echo $USESPROFILE [establishing connection(s) to] Password: ** [out ::] bashrc

** [out ::]

Thanks to the SliceHost support team for pointing me in the right direction on this one.



Just checking that you are human. What would be the result of this code?

a = 3*(4/2); b = 1; a+b