Search code examples
ruby-on-railsrubyrvmirbrbenv

Change Rails Console (IRB) Ruby Version OSX


I am having some trouble getting rails to run with the correct version of ruby in the rails console. I would like to use ruby 1.9.3 in the rails console.

When I run RVM list I get:

rvm rubies

ruby-1.9.3-p0 [ x86_64 ]
=* ruby-1.9.3-p194 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

When I run rbenv global I get:

 rbenv global                                                     
 1.9.3-p194

When I run rbenv local I get: rbenv: no local version configured for this directory

When I run ruby -v I get:

 ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]

When I run RUBY_VERSION in 'rails console'

 irb(main):001:0> RUBY_VERSION
 => "1.8.7"

When I run which ruby I get:

ruby: aliased to bundled_ruby

Thanks in advance for your help.


Solution

  • It seems like your rbenv is actually configured correctly. Test it by simply running which ruby and you should see /Users/USERNAME/.rbenv/shims/ruby. The real problem is when you run rails console. The rails command comes with osx, and you probably don't have a shim for it in rbenv.

    Try script/rails console from inside the project dir.