Update Ruby version and gems

Right now I’ve ruby 2.1.2 installed and I’d like to update to 2.1.4.

Whats the best way to move the gems I’ve already installed 2.1.2?

Hey Bassam,

This is a good example of a question that lacks enough detail for people to help you.

What OS are you on? Are you using rvm or rbenv?

Most importantly: what google searches have you done already that didn’t give you an answer to this? What have you tried already that didn’t work?

-Ben

Sorry for the incomplete question.

I’m running rbenv on OSX Yosemite. I tried googling for “How to move/install existing gems when updating ruby version” but that hasn’t helped much. I even spoke to some of my rails developer friends and they suggested creating gemsets using rvm or installing all the gems manually one by one. Both of these solutions aren’t viable as I don’t want to move to rvm and manually installation would take a lot of time and energy.

You cannot move your already installed gems to a new ruby install in any automated fashion, at least. It’s possible, I suppose, that you could copy the gems into the new ruby’s gem path, but why bother? You should be using bundler for dependency resolution - re-installing gems is just a bundle install away.

1 Like

Tim Pope has a rbenv plugin called rbenv-communal-gems, but as @derekprior said, given how easy it is to re-run bundler (or to pre-install frequent workflow gems with rbenv-default-gems) and the fact that you’re relying on complete backward compatibility in Ruby and Rubygems to make it work, I think it’s really not worth the risk.