D.C.
D.C.

Reputation: 15588

How do I get rails to use the latest installed version of ruby when creating a project?

New to Ruby and Rails, and I'm hitting a snag getting set up. I installed Ruby with MacPorts, then used gem to install rails. They both appear to be the correct versions:

$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11]
$ rails --version
Rails 3.1.1

However, whey I make a demo rails app with 'rails new demo' and then take a look at it with 'rake about', it looks like the ruby version is still 1.8:

About your application's environment
Ruby version              1.8.7 (universal-darwin11.0)
RubyGems version          1.8.11
Rack version              1.3
Rails version             3.1.1

I have verified that i have a symlink early in my $PATH pointing to the version of ruby I want (/opt/local/bin). How do I get rails to use ruby 1.9? thanks

Upvotes: 0

Views: 117

Answers (2)

robustus
robustus

Reputation: 3706

actually i'm pretty sure that this isn't about the macports version per se.

You may have change the symlink for ruby itself, but did you change the symlink for rubygems?

a.k.a are gem --version and gem1.9 --version both pointing to the same version? Because if not you´ve probably installed rails for ruby1.8.

For example on my System: Snow Leopard standard 1.8 version:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem --version
1.3.5

MacPorts 1.9 Version(already renamed):

/usr/bin/gem --version
1.3.7    

Upvotes: 1

Fadhli Rahim
Fadhli Rahim

Reputation: 121

I recommend you uninstall ruby from macports and try to do an installation using RVM instead.

http://beginrescueend.com/

In regards of your problem, it may probably be a path issue with Bundler executing the system rake command instead of the bundler.

Try running bundle exec rake about and see what happens.

Upvotes: 3

Related Questions