Reputation: 9163
Ubuntu already has Ruby 1.8.7 installed. Then I installed rvm and used it to install Ruby 1.9.2, which is the version I want to use. However, ruby -v always returns 1.8.7.
How do I get rvm to use Ruby 1.9.2?
bxu@vm-bxu:~$ rvm use 1.9.2
Using /usr/share/ruby-rvm/gems/ruby-1.9.2-p320
bxu@vm-bxu:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Upvotes: 3
Views: 1381
Reputation: 84343
RVM does its own installation magic, but in Ubuntu's case it doesn't always install to the right Bash startup file. You probably don't actually have RVM running properly; even though it's sort of installed.
You need to make sure the following two lines are at the BOTTOM of your ~/.bashrc file.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
export PATH=$PATH:$HOME/.rvm/bin
Then restart your terminal emulator or log back in. Note that sourcing ~/.bashrc has been known not to work in some cases, so this step will save your sanity.
RVM should now be working properly. The last step is to set your default Ruby.
rvm --default use 1.9.2
As I've just been reminded, RVM breaks Ubuntu login shells by installing ~/.bash_login, which overrides your Ubuntu ~/.profile in login shells. Move the code over to your ~/.bashrc if you haven't already done so, then remove or rename ~/.bash_login.
Upvotes: 3
Reputation: 53158
on Ubuntu you need to enable login shell in your terminal emulator, we have a quite good documentation for this at rvm site: https://rvm.io/integration/gnome-terminal/
Upvotes: -1