Erica Fischer-Colbrie
Erica Fischer-Colbrie

Reputation: 149

Can't switch default version ruby for rails

I'm desperate, please help. I can't figure out how to change Ruby on Rails to run with 2.0.0, even though I think I've done everything to set 2.0.0 as the default, and rvm -list doesn't even show 1.8.7 as an option. I don't know what files I need to move/what pathways I need to change, and my attempts to uninstall rails have been unsuccessful as there's a "missingBundle" error.

$ ruby - v 

returns ruby 2.0.0p247

$ rvm--default use 2.0.0 
Using /Users/ericafischer-colbrie/.rvm/gems/ruby-2.0.0-p247

Then,

$ rails -s 
Rails prefers to run ruby 2.0.  You're running ruby 1.8.7 (2012-02-08 patchlevel 358) 
[universal-darwin12.0].  Please upgrade to Ruby 1.9.3 or new to continue.

I've spent a lot of time looking at similar questions posted on stackoverflow and those solutions so far have not yielded any results.

Upvotes: 1

Views: 576

Answers (3)

Aravind
Aravind

Reputation: 1401

  1. Install rvm in your Macintosh
  2. Then do rvm install 2.0.0 or rvm install version(whatever version you need)
  3. Where ever you need a particular version of Ruby(say 2.0.0), do rvm use 2.0.0 and whichever version you need you can switch similarly.

If you are not sure how to install rvm or stuck with something else. Please see link for detailed explanation.


Updated, thanks @Momer.

Upvotes: 0

trh
trh

Reputation: 7339

Since you're using rvm, make sure you create a gemset and ruby-version file and install the version of rails you want to use.

E.g inside you're working dir tell rvm which ruby to use, which gemset to use, create both a gemset and ruby-version file:

rvm use ruby-2.0.0@my_cool_project --ruby-version --create

Then

gem install rails

To check run which ruby in that directory to make sure it's ruby 2 - - which rails will show you that it's using the gem of rails inside the ruby 2 my cool project gemset. Should be ok

Upvotes: 2

Momer
Momer

Reputation: 3237

Looks like you may have used something like sudo gem install rails.

When installing gems, you want to be sure to not use the sudo command.

Try sudo gem uninstall rails; rvm use ruby-2.0.0@myapp --create; gem install rails

Upvotes: 1

Related Questions