# Two Rails versions on the same computer?

**URL:** <https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621>\
**Category:** Rails\
**Created:** [March 21, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621 "2008-03-21T23:55:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 21, 2008, 11:55pm UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/1 "2008-03-21T23:55:46Z")

</div>

Can I install two different Rails versions on the same computer (without  
using a virtual machine)? I want to switch back and forth easily between  
Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a  
second version, there will still be only one rails file in my ruby\bin  
directory. How to resolve the two versions? I’m alternately using the  
command line, RadRails, and 3rd Rail.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 22, 2008, 12:13am UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/2 "2008-03-22T00:13:35Z")

</div>

Barry B. wrote:

> Can I install two different Rails versions on the same computer (without  
> using a virtual machine)? I want to switch back and forth easily between  
> Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a  
> second version, there will still be only one rails file in my ruby\bin  
> directory. How to resolve the two versions? I’m alternately using the  
> command line, RadRails, and 3rd Rail.

As far as the app goes, just set the GEM version in environment.rb. For  
the commandline tool, try renaming the rails binary to something else  
such as rails2 and then install the other version of the gem.

-matthew

---

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 22, 2008, 12:15am UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/3 "2008-03-22T00:15:46Z")

</div>

On Fri, Mar 21, 2008 at 6:54 PM, Barry B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Can I install two different Rails versions on the same computer (without  
> using a virtual machine)?

Yes. As many until your heart is content.

I want to switch back and forth easily between

> Rails 1.2.3 and Rails 2.0.2. I assume that if I try to gem-install a second  
> version, there will still be only one rails file in my ruby\bin directory.

Say you have both 1.2.3 and 2.0.2 installed and you want to create a  
new 1.2.3 app.

you can: “rails _1.2.3_ newapp”

if you are working with applications that exist already, just set the  
gem version in environment.rb

RAILS\_GEM\_VERSION=“1.2.3”

HTH

---

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 22, 2008, 12:21am UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/4 "2008-03-22T00:21:39Z")

</div>

On Mar 21, 2008, at 23:54 , Barry B. wrote:

> Can I install two different Rails versions on the same computer  
> (without using a virtual machine)? I want to switch back and forth  
> easily between Rails 1.2.3 and Rails 2.0.2. I assume that if I try  
> to gem-install a second version, there will still be only one rails  
> file in my ruby\bin directory. How to resolve the two versions? I’m  
> alternately using the command line, RadRails, and 3rd Rail.

The basic pieces to take into account here are:

- Several versions of the same gem can be installed without problem,  
RubyGems provides ways to refer to them if needed

- If Rails was frozen under vendor/rails that’s the one used  
unconditionally, you can even run that application without a system-  
wide rails installed, it is self-contained in that sense

- Otherwise if RAILS\_GEM\_VERSION is uncommented in environtment.rb  
that specific version of the gem is the one loaded

- Otherwise the rails gem is loaded without a version constraint

– fxn

---

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 22, 2008, 12:21am UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/5 "2008-03-22T00:21:39Z")

</div>

As a heads up…

If you are using RAILS\_GEM\_VERSION=“1.2.3” in environment.rb

and you have both 1.2.3 and 2.0.2 installed …

if you use “script/console” you will more than likely get a message  
that you are using rails 2.0.2

Don’t let that confuse you, your applications will be using what you  
specify in environment.rb

On Fri, Mar 21, 2008 at 7:13 PM, Matthew I.

---

<div class="post-metadata">

**Author:** ![Barry\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/73ab20/32.png) [@Barry\_B](https://www.ruby-forum.com/u/Barry_B)\
**Post date:** [March 22, 2008, 12:47pm UTC](https://www.ruby-forum.com/t/two-rails-versions-on-the-same-computer/132621/6 "2008-03-22T12:47:19Z")

</div>

Barry B. wrote:

> Can I install two different Rails versions on  
> the same computer (without using a virtual  
> machine)? I want to switch back and forth  
> easily between Rails 1.2.3 and Rails 2.0.2.

In addition to the approaches suggested by other responders, if you’re  
running on Windows you should consider Instant Rails. I’ve found it to  
be  
the least complicated, least error-prone solution to the problem you’re  
working.

Best regards,  
Bill
