RVM is not working over SSH

Viewed 9939

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_config has 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
10 Answers
Related