Im using Zsh on the client and server. When I use ssh to run a command on the remote server it can not find the binary:
ssh gt "cd /home/****/app/staging && bundle exec rake db:migrate RAILS_ENV=staging"
zsh:1: command not found: bundle
I can run the same command fine if I SSH in with an interactive shell.
On the server the $PATH
is set in both .zshrc and .zshenv
EDIT
It appears bundle
is not in my $PATH on the server. Maybe this has something to do with RVM (Ruby Version Manager) which hooks in to cd
, so when you cd
in to a directory with a .rvmrc
file it sets up the Ruby environment and adds bundle
to the $PATH. I need to find out if the cd
hook is also triggered for non-interactive shells.
man zsh
, the file sourced by non-login shells is.zshenv
. This means thatbundle
is not found in the$PATH
set in that file. Do a simple checkssh gt 'echo $PATH'
(mind the single quotes!). – rozcietrzewiacz Nov 04 '11 at 10:59