tags:

views:

486

answers:

3

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.

+1  A: 

Try this:

rvm use --default 1.8.7
HN
This doesn't affect anything, it keeps me on the system Ruby.
Evan Cordell
+4  A: 

Typically rvm support is easiest via IRC (#rvm on freenode) - in this particular case, what does running "type rvm | head -n1" show? it should show "rvm is a function". If not, that means the line to source rvm isn't being run correctly and hence switching doesn't work. Typically this means you either have a return in your ~/.bashrc or you missed adding the line to source rvm.

Sutto
That command spits out "rvm is /usr/local/bin/rvm" rather than "rvm is a function", however, my .bashrc file seems to be set up correctly as per the installation guide. I'll check the irc channel though, thanks.
Evan Cordell
It was a problem with my .bashrc; since I was root it installed in a different location than the instructions said it would be, and I had to change the source line to reflect that.
Evan Cordell
Could you tell us what you changed in your bashrc file?
Lichtamberg
Lichtamberg: When it's root, you source from /usr/local/rvm/scripts/rvm versus $HOME/.rvm/scripts/rvm - simply changing the source line to match that is what it sounds like Evan did.
Sutto
Sutto: That's exactly what I did.
Evan Cordell
+1  A: 

Your install is as root account. Try this in shell [[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"

before rvm switch operation. I add this line in my profile file and now all is ok.

germanlinux