Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change my Ruby version using RVM?

Tags:

ruby

rvm

I am not able to switch the current Ruby version:

➜  ~  rvm list

rvm rubies

   ruby-1.9.2-p290 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64 ]

➜  ~  rvm use ruby-1.9.3-p0

RVM is not a function, selecting rubies with 'rvm use ...' will not work.
like image 264
donald Avatar asked Dec 29 '11 04:12

donald


People also ask

How do I change the default version of Ruby in RVM?

Try running rvm --default 1.9. 2 instead. That works for me. Did you accidentally put the line to load rvm in your bashrc instead of your bash_profile ?

How do I change the current version of Ruby?

Set Ruby version with rvm on Mac 0 on the command line. To switch to the system ruby, enter rvm use system . To switch back to the default, rvm default . The command rvm list will show all installed Rubies, including the current and default versions.


3 Answers

Fixed it. I needed to add:

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

to .zshrc

like image 127
donald Avatar answered Oct 23 '22 06:10

donald


This happened to me too. I had:

export PATH=~/.rvm/bin:$PATH

Added in my .bashrc.

All I had to do was add another

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

to the same file and it worked! Of course, you have to restart your terminal after that.

like image 34
The Mitra Boy Avatar answered Oct 23 '22 05:10

The Mitra Boy


Your shell doesn't know about the RVM function. After you install it, it tells you how to take care of this. Or go to the install page on the RVM site and check out the section titled "2. Load RVM into your shell sessions as a function"

Run this once to add the line that loads rvm into your ~/.bash_profile:

$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

or manually add it yourself. (Note that on some systems, you will want to put it in other places, for example on my system, Mac OSX Lion, I put it in ~/.profile)

like image 11
Joshua Cheek Avatar answered Oct 23 '22 04:10

Joshua Cheek