Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1
WOW, JUST WOW.
All I had to do was gem install bundler
and then rbenv rehash
. Everything worked.
The original error message pointed me to a problem with RBENV or my Ruby version when in reality it was just falling back on an old version of bundler.
Why wouldn't I have received the more standard this needs bundler version [xxxx]...
error instead of telling me my Ruby version is specified incorrectly?
rbenv Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
What version of ruby are you using?
ruby -v
It sounds like the Gemfile has a ruby requirement listed for 2.1.2. You may need to install that version:
rbenv install 2.1.2
Then you may need to tell rbenv to use that version for that project:
rbenv local 2.1.2
It looks like the rbenv team/community decided against adding support for ruby versions specified in the Gemfile. Reference: https://github.com/sstephenson/rbenv/issues/223
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 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
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.0
Run
gem install bundler
or
gem update bundler
which may fix your problem.
For all new installed versions of Ruby you should update or install a new bundler.
Rbenv Version 2.1.1, but Error Says Ruby Version is 2.0.0
Bundler is trying to tell you that the version of Ruby you have loaded is not matching the one you specified in your Gemfile.
rbenv install 2.1.0 && rbenv local 2.1.0
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2 without update Gemfile
RVM and RBenv are actually similar tools. There are no practical reasons to keep them alongside each other in one session (and on one machine most of the time). They both rely on modifying PATH
environment variable to get the Ruby and supplementary binaries closer for easy use.
And that's what RVM complains about: PATH
is not what it expects to be. That said, RBEnv apparently tampered with it. Since these tools do their best to overtake ruby
, gem
, irb
and stuff, they may very well conflict with each other on occasions.
So, remove one of them. Which one, is up to you. Removing RVM is as easy as:
rvm implode
...that will remove RVM's files, rubies and gems for them, but you might also want to inspect .bash_profile
, .profile
and .bashrc
for relevant lines.
The uninstallation process for RBEnv seems to be the manual one: remove the folder, review the files listed above for relevant lines.
Fix Your Ruby version is 2.6.8, but your gemfile specified 2.5.5
Finally got it working.
So the key to the problem as well to the solution was the fact that which bundle
gave:
/usr/local/bin/bundle
while which ruby gave:
/Users/Mahmoud/.rbenv/shims/ruby
indicating that bundle isn't using ruby from rbenv.
I already had the path set in ~/.bash_profile
:
export PATH="$HOME/.rbenv/shims:$PATH"
eval "$(rbenv init -)"
but apparently this was not enough as I was using zsh. Had to add those same 2 lines to ~/.zshrc
as well and restarted terminal. Now bundle install is working as expected.
After updating ~/.zshrc
which bundle
gives:
/Users/Mahmoud/.rbenv/shims/bundle
indicating that the problem was just that bundle was using the wrong ruby.
So if you have this problem, just make sure ~/.bash_profile
and ~/.zshrc
have the correct path by adding the 2 lines indicated above. Restart terminal and check if its working now.
How to fix Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
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'
Your Ruby version is 2.1.0, but your Gemfile specified 2.0.0
You may need to update your version of ruby-build
to make sure you have the update where ruby-2.0.0-dev
switched to follow the ruby_2_0_0
branch.
Try running ruby-build --version
and make sure it's one of these (or later):
- v20130907
- v20130901
- v20130806
- v20130628
- v20130518
- v20130514
- v20130501
- v20130408
- v20130227
- v20130226
- v20130225
If not, run brew upgrade ruby-build
.
Related Topics
How to Access Method Arguments in Ruby
Ruby - Net/Http - Following Redirects
Imagemagick - "Core_Rl_Magick_.Dll Not Found" or How to Install Rmagick on Windows With Ruby 1.9.2
Exporting an Environment Variable in Ruby
How to Change the Default Path of View Files in a Rails 3 Controller
How to Use Activerecord in a Ruby Script Outside Rails
How to Wrap Link_To Around Some HTML Ruby Code
How to Use Bundler Behind a Proxy
Rails4 Unknown Encoding Name - Cp720
What Is the Use of Gemfile in Rails
How to Use Global Variables or Constant Values in Ruby
Find Unused Code in a Rails App
Rails Console: Reload! Not Reflecting Changes in Model Files? What Could Be Possible Reason
Best Practices For Reusing Code Between Controllers in Ruby on Rails