crothstein
crothstein

Reputation: 71

When you run "rails server" how do you get the ruby version to match what you see with "ruby -v"?

I can't seem to get my version of ruby when running "rails server" to be the same as the one in terminal. If I run commands like ruby -v I get 1.9.3 which is the version that I want to use. But I get 1.8.7 when I use rails server. Any idea how I get get my local server to leverage 1.9.3? I am using a Mac with Lion.


CHRISs-MacBook-Pro:test_app chrisrothstein$ rvm list

rvm rubies

=* ruby-1.9.3-p125 [ x86_64 ]

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

CHRISs-MacBook-Pro:test_app chrisrothstein$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]

CHRISs-MacBook-Pro:test_app chrisrothstein$ rails server
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-04-07 15:48:50] INFO  WEBrick 1.3.1
[2012-04-07 15:48:50] INFO  ruby 1.8.7 (2010-01-10) [universal-darwin11.0]
[2012-04-07 15:48:50] INFO  WEBrick::HTTPServer#start: pid=53174 port=3000

Upvotes: 3

Views: 1695

Answers (1)

jefflunt
jefflunt

Reputation: 33954

If this is a Rails 3 app, then you're using bundler by default. So, run your server within the bundler context.

Do bundle install if you haven't already to install all the gems in your Gemfile. The run your server this way instead:

bundle exec rails s

This should make the ruby version match what is shown in rvm.

Upvotes: 2

Related Questions