Best way to upgrade to Ruby 2.3 through rvm while keeping all your gems?

12,765

EDIT

This question has an answer here: RVM: How to use gems from a different ruby?

$ rvm gemset copy $oldversion 2.3.0    ## Assign or replace $oldversion with old version name

ORIGINAL

Before installing Ruby 2.3, get a list of your installed gems and their versions using gem list. Then, after you install Ruby 2.3, use rvm to set 2.3 as the new default:

$ rvm install 2.3.0
$ rvm --default use 2.3.0

If you use Bundler, gem install bundler and then bundle install in all your project directories. This should install all of the gems relevant to your work.

If you don't use Bundler, or if you have gems installed that aren't part of any project's Gemfile, then you will want to go through the list of gems and their versions that you made earlier and gem install each of them, using -v to specify the version.

Share:
12,765

Related videos on Youtube

sbs
Author by

sbs

Updated on June 04, 2022

Comments

  • sbs
    sbs almost 2 years

    What's the best way to upgrade to Ruby 2.3 through rvm while keeping all your gems installed on previous version (e.g. json, nokogiri, etc)?

  • Cary Swoveland
    Cary Swoveland over 8 years
    Can you offer any advice to automate the installation of gems for a new Ruby version, assuming you want the same gems that are installed for a previous version?
  • Andrew Lobban
    Andrew Lobban about 8 years
    This doesn't answer how to install Ruby 2.3.0 with RVM. This is assuming you already have 2.3.0 installed locally. So where can I find RVM installation of Ruby 2.3.0?
  • Andrew Lobban
    Andrew Lobban about 8 years
    @JesseSielaff, I figured out my issue; because of the network security policies at work I was being blocked from downloading 2.3.0 when I ran rvm install 2.3.0. It gave me a generic error message that made me think that RVM couldn't get the latest Ruby. My mistake
  • Vignesh S
    Vignesh S almost 8 years
    @AndrewLobban Ya I can understand your problem I too have the same issue at my work place... if you want an offline installation I would suggest you to create an account in c9.io and then download all the necessary gems and installation files there and then in your workplace you can download it from c9... and install it locally.. use these commands. "gem install rails -i repo --no-rdoc --no-ri" in cloud9 to download all the gems and in your workplace after downloading all the gems from cloud9. use this command to install all the gems locally. "gem install --force --local *.gem" .
  • Vignesh S
    Vignesh S almost 8 years
    @AndrewLobban Please refer this page for more details help.rubygems.org/kb/rubygems/installing-gems-with-no-networ‌​k
  • Andrew Lobban
    Andrew Lobban almost 8 years
    Thanks @vigneshsivakumar! That's how I was able to figure out the issue was a network policy at work by using Cloud9. I also used my personal machine to pull the latest upgrade 2.3.0 and most recently the 2.3.1.