How do I upgrade my ruby 1.9.2-p0 to the latest patch level using rvm?
My current version of ruby is ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.5.0]
but I want to update it to the latest patch level using rvm. How can I do this?
First of all, update your RVM installation by running rvm get stable
.
To make sure you're running the new RVM version, you'll then need to run rvm reload
(or just open a new terminal).
Once that's done, you can ask RVM to list the ruby versions available to install by running rvm list known
.
In the output you should now see:
# MRI Rubies
...
[ruby-]1.9.2[-p320]
...
The square brackets around the patch level indicate that this is currently RVM's default patch level for ruby 1.9.2.
Finally, to install the new ruby version, just run rvm install 1.9.2
- and wait for it to compile!
Upgrade ruby interpreter and keep existing gemsets:
$ rvm upgrade 1.9.2-p0 1.9.2
Are you sure you wish to upgrade from ruby-1.9.2-p0 to ruby-1.9.2-p136? (Y/n): Y
To replace with the latest stable release of 1.9.2. This avoids clutter.
Some additional helpful tips, thanks to comments (@Mauro, @James, @ACB)
$ rvm list known
# NOTE: you probably want to upgrade your rvm first, as the list of known rubies seems to be coupled to the rvm version.
$ rvm get stable
$ rvm list known #pick your ruby
First update RVM:
rvm get stable
Then update your Ruby version:
rvm upgrade 2.0.0
Choose yes for all the questions:
Are you sure you wish to upgrade from ruby-2.0.0-p195 to ruby-2.0.0-p247? (Y/n): Y
Are you sure you wish to MOVE gems from ruby-2.0.0-p195 to ruby-2.0.0-p247?
This will overwrite existing gems in ruby-2.0.0-p247 and remove them from ruby-2.0.0-p195 (Y/n): Y
Do you wish to move over aliases? (Y/n): Y
Do you wish to move over wrappers? (Y/n): Y
Do you also wish to completely remove ruby-2.0.0-p195 (inc. archive)? (Y/n): Y
If you wish to update your gems to the latest versions, you can do:
rvm all do gem update
EDIT: I just did this today for the latest version of ruby 2.0.0 (I updated from ruby-2.0.0-p195 to ruby-2.0.0-p353). After that, I was getting segmentation fault when I tried to update gems. This happens because the gems were installed for ruby-2.0.0-p195 and some of them are incompatible with p353.
Now you can go and try to find the gems that are incompatible, but the easiest solution was to remove all installed gems and install them again. I simply removed gems/ruby-2.0.0-p353
directory that was located in /usr/local/rvm
. It could be somewhere else for you.
Then I ran gem install bundler
and for each of my rails apps I did bundle install
.
like this:
rvm update; rvm reload
rvm install ruby-1.9.2-p136
rvm --default ruby-1.9.2-p136
You can install any patch level by following the page in their wiki.
Also, each ruby is independent, so you aren't really 'upgrading and keeping the gems' but installing a new patch version and then installing the gems in that new ruby environment.
This may be were gemsets come into play, however I don't use them.
Do not forget to update your rvm too, just in case it's been awhile.