How do I upgrade Rails?

gem update rails does nothing for you, because bundler makes sure that only the gems specified in your Gemfile are loaded and used.

So in order to upgrade to Rails 4, you need to change the Rails version number in your Gemfile and run bundle update rails.

This Railscast guides you through all the steps of manually updating an existing application from Rails 3.2 to Rails 4:

http://railscasts.com/episodes/415-upgrading-to-rails-4


If you are using RVM then you should create a seperate gemset first like:

rvm gemset create whateverName

in this example I will install rails 4

rvm install 2.0.0

rvm list  

rvm 2.0.0 

^^^^(you may need to copy and paste the version number exactly here as it was displayed in rvm list)

rvm gemset create rails4

rvm gemset use rails4

add the following to your gemfile for existing apps

gem 'rails', '4.0.0'

then run

bundle update rails

or do following to just install the gem

gem install rails --version=4.0

UPDATE

If you havne't installed Xcode 4.5 CLI tools then you will need to

Preferences > Downloads > Components

DMG

https://developer.apple.com/downloads

you may then also need to use homebrew to update gcc

brew install apple-gcc42

the following link has all the information you will need:

https://thoughtbot.com/blog/the-hitchhikers-guide-to-riding-a-mountain-lion


If you already have a Rails project you should:

  • Specify the desired version in your Gemfile (e.g. gem 'rails', '~> 5.2.0.rc1')
  • Run bundle install (bundle update may be needed)
  • Run rails app:update (rake rails:update for 4.2 and earlier)
  • Follow instructions on screen
  • Follow the official guide for additional steps depending on your version