Search code examples
ruby-on-railsruby

How to fix "Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0"


I created a Ruby project, but when running bundle update and bundle install it returns an error:

Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0

An image of it is: https://i.sstatic.net/awxw8.png

My gemfile is:

ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.0'

group :development do
    gem 'sqlite3', '1.3.8'
end

gem 'sass-rails', '4.0.0'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.0'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
    gem 'sdoc', '0.3.20', require: false
end

Solution

  • If you run ruby -v you're going to see that you've installed Ruby 1.9.3, but the first line in your Gemfile specifies that you want to use Ruby 2.0.0.

    You should either install Ruby 2.0.0 or change the first line in your Gemfile to specify Ruby 1.9.3.

    sample of Gemfile:

    source 'https://rubygems.org'
    ruby "1.9.3"
    
    gem 'pry'
    
    gem 'pry-nav'
    
    # Use with command-line debugging, but not RubyMine
    #gem 'debugger'
    
    gem 'bundler'