Why do I get the error "Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2" although I have 2.2.2 installed Why do I get the error "Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2" although I have 2.2.2 installed ruby-on-rails ruby-on-rails

Why do I get the error "Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2" although I have 2.2.2 installed


You have a system bundler installed, and rbenv is always trying to pick that up. Based on the steps on this site:

  • Make sure you are using the proper gem version. Type which gem and gem env and check that it points to your 2.2.2 ruby version
  • Install bundler using this gem: gem install bundler
  • Once this version of bundler is installed run rbenv rehash
  • Call which bundler, make sure it now points to the shim version of bundler

gem install might not work properly with rbenv if you have your GEM_HOME or GEM_PATH variable overriden, or if you have custom configs in ~/.gemrc, ~/.gem/gemrc or /etc/gemrc. Check the result of gem env, it should say something like this:

- INSTALLATION DIRECTORY: /Users/<youruser>/.rbenv/versions/<ruby-version>/lib/ruby/gems/<ruby-framework-version>(...)- GEM PATHS:  - /Users/<youruser>/.rbenv/versions/<ruby-version>/lib/ruby/gems/<ruby-framework-version>

(note the ruby-framework-version doesn't always exactly match the ruby-version. If the ruby-version is the correct one then the path should be alright)

if not, make sure you don't have any environment overrides or custom configs inside the files mentioned above.

You might also want to try to remove all bundlers from your machine and try again afterwards:

  • rbenv local system
  • gem uninstall bundler
  • rbenv local 2.2.2
  • gem uninstall bundler


I finally solved my problem using this thread Bundler not working with rbenv, could not find [gem],

by using these commands after reinstalling rbenv:

  • gem install --no-ri --no-rdoc bundler
  • rbenv rehash
  • bundle --path=vendor/bundle


For me the problem was that I hadn't properly re-initialized rbenv after installing and switching to the new ruby version.

In my shell config I had an incorrect check to avoid executing source (rbenv init -|psub) if rbenv wasn't installed. After manually sourcing it worked again.