Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ruby

rubygems

rvm

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)?

like image 541
sbs Avatar asked Dec 31 '15 01:12

sbs


People also ask

How do I install a specific version of Ruby?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.


1 Answers

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.

like image 113
user513951 Avatar answered Jan 22 '23 03:01

user513951