RVM is not working over SSH.
At the command-line:
leifg@host:~$ which ruby
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby
Connected over SSH:
local:~$ ssh leifg@server 'which ruby'
/usr/bin/ruby
I’m using Ubuntu 11.04.
How do I get SSH to use the same Ruby as it is on the system?
I already verified some prequisites:
- Ruby was already installed using
apt-get install ruby. Does that make any difference? sshd_confighas the option “PermitUserEnvironment yes”, and I restarted the daemon.
The .bashrc on the server contains these lines, but I see the same behavior when I remove them:
if [ -s "$HOME/.rvm/scripts/rvm" ] ; then
. "$HOME/.rvm/scripts/rvm"
elif [ -s "/usr/local/rvm/scripts/rvm" ] ; then
. "/usr/local/rvm/scripts/rvm"
fi
From the
sshman page:This should mean that your
.bashrcwon’t get sourced, so RVM doesn’t get set up.Solution
This did the trick in the end:
Start bash as a login shell through SSH and then start the RVM installed Ruby via SSH’s
-coption.