How can I install different versions of Rails and keep the existing ones?

You can define the Rails version of an application in config/enviroment.rb.


To answer your question, you can install many versions of the rails gem without conflict. However, each project is created using a specific version. To install a new version of the rails gem as follow; Change the version 3.2.18 with any version you like (see link below for all available versions).

gem install rails --version=3.2.18

To install the latest version

gem install rails

To check all the rails version available, check out this link

Here is a link to all the version of rails

You might consider updating your gem software by this command prior to loading new gems.

gem update --system

As per @pjmorse, list the version installed with this command

gem list rails

Hope that helps


You still have both versions, as the other answers have mentioned. However, you don't want to call rails newapp and then change the config/environment.rb file. This will cause problems for any files that have changed between versions. Instead, create a new 2.3.5 app this way:

rails _2.3.5_ newapp

And you'll run the exact version of rails you want, to create the file structure correctly. I don't know why this isn't documented better.


gem list rails should show you all installed versions of Rails. You can specify which one you want each project to use in the config/environment.rb file.

Alternately (or "additionally"), look in to RVM (particularly the "gemset" function) for maintaining separate gem sets for each project.

Updated May 2017 Instead of RVM gemsets, best practice for managing gems in Rails projects (including the Rails gem itself) is to use Bundler. Bundler's Gemfile will list all the gems your project uses, and allows you to "pin" versions, so by changing the version pin for Rails and running bundle you can update your project to the new version.

<sarcasm>Now that I've said that, though, Bundler is probably on the way out to be replaced by something else. </sarcasm>