Avalanche Effect

Homebrew of polygons, startups, and a dash of coding bits.

Upgrading to Ruby 2.0.0 With CarrierWave/RMagick

I had an issue today upgrading to Ruby 2.0.0 using CarrierWave/RMagick and rails s wouldn’t run. The steps are listed below to get it working again.

Upgrade Rails

In most cases, just change the Gemfile specification to:

1
2
source 'https://rubygems.org'
gem 'rails', '3.2.12'

Then run:

1
2
3
$ bundle update rails
$ rails -v
Rails 3.2.12

The Rails gem will be updated by bundler and the Gemfile.lock file will be updated to record the new gem version. You’ll see a message showing which version of Rails is running when you start the webserver.

Upgrade Ruby

On Mac OS X, the easiest way to get latest Ruby is via Homebrew:

1
2
3
$ brew install ruby
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]

Upgrade Rake, Bundler, Rubygems-Bundler

Most developers often install the latest version of Rails/Ruby but neglect other components. These are important to keep regularly updated.

1
2
3
4
5
$ gem -v                        #Check the gem versions
$ gem update --system           #Upgrade RubyGems system gem
$ gem update rake               #Upgrade Rake
$ gem update bundler            #Upgrade Bundler
$ gem update rubygems-bundler   #Upgrade Rubygems-Bundler

Upgrade RMagick

If you’re using CarrierWave, sometimes upgrading latest Ruby/Rails will create issues when running the rails server. Easiest fix is to reinstall rmagick with your current imagemagick.

1
$ gem install rmagick

Bundle Update

Good to always ensure nothing was missed.

1
$ bundle update

Here’s a good blog post to Upgrade from Rails 3.2 to Rails 4.0 by Mario Chavez.

Here’s also an Ebook Upgrading to Rails 4 by Andy Lindeman.