Search code examples
ruby-on-railsrbenv

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


I'm using rbenv and I get the error Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2 when I run the bundle install command in my project. The strange thing is that I've actually got the 2.2.2 version installed (as my Gemfile specifies), and not the 2.0.0 version. (See image below).

enter image description here

I tried the solution offered in this thread: Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0, but it had no effect.

I'm on an MacBook Air with Yosemite if that makes any difference.

Update:

  • which ruby -> Users/myuser/.rbenv/shims/ruby
  • ruby -v -> ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
  • rbenv global 2.2.2 and rbenv rehash, has no effect
  • which bundle -> /usr/bin/bundle
  • gem env-> - GEM PATHS:
    • /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0
    • /Users/myuser/.gem/ruby/2.2.0

Solution

  • 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