Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to update all of RVM rubies and gems after system update?

I'm seeking a more streamlined and robust approach to keeping my rvm environment intact after an OS update. I'm using Mountain Lion, rvm 1.18.16 and homebrew, which has readline, gettext, libxml2, libxslt, qt, gtk+ -- the gems that usually break for me are nokogiri and capybara-webkit

Twice now after updating Mountain Lion and XCode, my native extension gems and Ruby have suffered breakage and I have to spend time getting everything working again. I have to wonder if I'm following the best practice for getting all the rvm components updated after such system update.

What typically happens is that gems with native extensions are linking against old libraries that are no longer available, especially with the libxml issues surrounding Mountain Lion. Here's the basic steps I take to get my system back online across all projects (I have about 8 versions of Ruby installed under rvm, so this is tedious!).

First, update Mountain Lion and XCode via the App Store.

Second, Update homebrew with:

brew update
brew upgrade

Then list your rubies and start recompiling each one with...

rvm list
rvm reinstall ruby-1.9.2-p290
rvm reinstall ruby-1.9.3-p392
...

NOTE: I did try:

rvm all do reinstall

but that gave me this error: "reinstall: command not found"

Next up, step through each ruby and perform pristine on the gems (this has side effect of recompiling all native extension gems):

rvm use ruby-1.9.3-p392
gem pristine --all

Finally, go to each project and perform the following:

bundle install

I'm not sure if that last step is strictly necessary -- some projects seemed to be ok, some weren't, but running this seemed to clear up last remaining issues.

Surely there's a more streamlined way to manage this process!? I've only been using both Mountain Lion and rvm for a couple months, but in that time, two system updates have killed most of my working Ruby environment. I have a lot of Ruby versions installed because of my job as a consultant and encountering many development environments, so I'd really like to get this down to an easily repeatable process.

Any thoughts? Can the above be further improved?

like image 290
Michael Lang Avatar asked Mar 07 '13 19:03

Michael Lang


1 Answers

You can do:

rvm reinstall all

append --force to skip the questions.

Note that will do full reinstall including gem pristine of every gem, you need to pay attention to the output as it will notify you about the gems that failed to executes the pristine action.

like image 174
mpapis Avatar answered Nov 12 '22 18:11

mpapis