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
“rvm” has two invocation bugs: the default installation drops the file /etc/profile.d/rvm.sh
and believes any bash trick is now globally available. – This assumption is wrong.
Files in /etc/profile.d/
are “sourced” on login, but maybe not from bash, maybe not even from a shell. So the cd
hook it installs is not there after the shell which runs these files exits. Actually, because of the buggy way “rvm” installs this hook, it is already gone once you run naked bash
in a login-shell!
I don’t know if “rvm” supports an explicit invocation for virtual environments, without relying on cd
ing into some directory (that I consider the second bug).
There is one sane workaround:
Make your shell source /etc/profile.d/rvm.sh
from e.g. ~/.bashrc
. .bashrc
is executed from any non-login bash, and login-bash is usually setup to source .bashrc
from those login-shell files like ~/.profile
For your ssh problem: should a proper ssh-shell not be login-shell anyway?