Read more

Upgrade from Ruby 1.8.7 to Ruby 1.9.2 on Ubuntu

Henning Koch
March 25, 2011Software engineer at makandra GmbH

Note that you cannot currently use Ruby 1.9.2 with Rails 2 applications that use RSpec, so don't upgrade if that is your setup. The rspec-rails gem has a fatal bug Show archive.org snapshot that was only fixed for rspec-rails-2.x, which only supports Rails 3. There is no fix for the rspec-rails-1.3.x series of the gem which supports Rails 2.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Anyway, here are upgrade instructions if you only work with Rails 3 or don't use RSpec. You will lose all your gems in the process, but you can get them back easily if you have been using Bundler.

sudo apt-get uninstall ruby1.8 ruby
sudo apt-get install ruby1.9.1 ruby1.9.1-dev # this is actually Ruby 1.9.2
sudo ln -s /usr/bin/ruby1.9.1 /usr/bin/ruby
# Now download RubyGems from https://rubygems.org/pages/download
tar xvzf rubygems-1.x.x.tgz
cd rubygems-1.x.x
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.9.1 /usr/bin/gem
sudo gem install bundler

You will now need to run bundle install in your projects to get your gems back.

Posted by Henning Koch to makandra dev (2011-03-25 21:51)