Ruby – RVM doesn’t switch Rubies

rubyrvm

I'm running Ruby 1.9.1p243 on CentOS, and I decided to install rvm to handle upgrading to 1.9.2 or downgrading to 1.8.7 (whichever turns out to work better for rails3).

I followed the instructions here: http://rvm.beginrescueend.com/rvm/install/ and everything installed correctly. I was able to compile and install Ruby 1.8.7, 1.9.1, and 1.9.2.

However, if I try to actually switch to one of the rvm installed Rubies, with rvm use 1.8.7, for example, nothing works. My system still uses the Ruby I have installed in /usr/local/bin/ruby.

An example of the output I get:

$ rvm use 1.8.7
$ ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
$ which ruby
/usr/local/bin/ruby
$ rvm use 1.9.2
$ ruby -v
ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux]
$ which ruby
/usr/local/bin/ruby

I have no idea why this is happening, and I can't seem to find anything online about the issue either. Any help would be appreciated.

Best Answer

Just came across the same problem.

Instead of appending the following script to ~/.bash_profile, append it to ~/.bashrc:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

And then restart the terminal.