Pam Nunez
Pam Nunez

Reputation: 37

Installed ruby 2.1.1, rails is using 1.9.3

I'm trying to run my first rails app and I have specified ruby 2.1.1 in my Gemfile, but when I try to run bundle install I get the following meessage:

Your Ruby version is 1.9.3, but your Gemfile specified 2.1.1.

When I run rvm current, I get 2.1.1 as the current ruby install. However, when I enter ruby -v, I get 1.9.3. How do I get rails to recognize 2.1.1 as the current version? Sorry if this is a dumb question, but I'm very new to this and I'd like to get started on my first app! Thanks for your help. I'm running Ubuntu 12.04.

Upvotes: 0

Views: 2496

Answers (2)

user2107733
user2107733

Reputation:

Some useful commands:

  • use rvm install 2.1.1 if you want to install ruby 2.1.1
  • set default with rvm --default use 2.1.1 if you want to use latest ruby
  • or you can switch back to different ruby version e.g. 2.0.0 with rvm use 2.0.0

Upvotes: 1

bjhaid
bjhaid

Reputation: 9752

You can specify which version of ruby you want to use via:

rvm use 2.1.1 do bundle install

but I would advice you create .rvmrc file or a .ruby-version file

sample .rvmvrc would contain

rvm use 2.1.1

sample .ruby-version would contain

2.1.1

with a .ruby-version or .rvmrc whenever you cd into your project rvm would automatically change your ruby version to the desired one

Upvotes: 3

Related Questions