Skip to main content

Having different rails and gems versions installed on dev environment ?

Rails • Asked by Lykos

Hi all,

I'd like some clarification from someone who's more expert than me, if possible.

I'm currently having RVM and Rails 4.2.6 installed on my development environment in which I have built a few projects. Now, for my new projects I'd like to use the latest rails version (currently v5). So I assume that if I type the gem install rails command will get me the latest rails verion and probably set it as default, so every time I want to create a new project with rails new mynewprojectname this project will have the latest version, right?

My question is will my gem list contain both rails versions then, or is it going to cause any conflicts or issues to my old porjects, maybe by overwriting the rails gem? So if I want to work back on any of my "old" projects which has the "old" version, won't affect of any changes, right?

As far as I understand its the bundler who picks the version of each gem through the gemfile (unless you don't specify the version number, which in this case picks the latest version), right? If thats the case, I assume same thing applies and for every other gem that I've installed and use for each project, right?


Yeah, it sounds like you understand it correctly. If you install a gem like Rails multiple times, you can have multiple versions of it on your system. It will always try to use the latest version if you say "rails new", but you can also specify the version to an older one if you want to generate an older Rails app.

The list of installed gems on your system will show everything. However the gems in your app's Gemfile will only be the ones you're using (for example, Rails 5 and it's dependencies).

Bundle takes care of the discrepancy to lock the version numbers down to the ones that each version of Rails or each app has defined. It can look through all the gems you have and say okay you have 3 versions of this, I want version X. It does that so you don't have to worry about it.

I have Rails 3.2, 4.2, and 5.0 installed on my computer and run apps on various versions regularly with no issues because Bundler takes care of everything. 👍


Thank you for your reply Chris!

Is this the most efficient or correct way of setting things then? Or is it better to use gemsets instead? Cause as far as I understand now all my gems are installed in a "global" scope. Also if that's the case (using gemsets) how can I create gemsets for my existing projects (old)?


Nah, no reason to use gemsets anymore because Bundler does everything they do, but in a better fashion. Because your Gemfile is included inside your repository, you always know which gems and which versions to use for each app. That pretty much removes any need for gemsets these days.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.