1

I am setting up my new machine (Mac Yosemite) and when I run the command "bundle" I get the following error:

Your Ruby version is 2.2.1, but your Gemfile specified 2.2.0

I'm trying to change the version w Rbenv but I think it's not working.

ruby -v
// Ruby 2.2.1p85

rbenv version
// 2.2.0

Can anyone help me? Thanks in advance!

3 Answers3

0

Try to use rbenv local [version number].Refer to this for more understanding.

Community
  • 1
  • 1
avinash pandey
  • 1,321
  • 2
  • 11
  • 15
0

I had a similar problem but with ruby -v 2.2.0 and Mac OSX El Capitan. What finally worked for me was:

  1. gem install bundler (apparently it was no longer installed)
  2. rbenv rehash
  3. bundle install

I was able to find the answer on the github for rbenv. https://github.com/sstephenson/rbenv/issues/697

Ana Isabel
  • 931
  • 1
  • 11
  • 21
0

Assuming you have Ruby -v 2.2.0 installed (rbenv install 2.2.0 otherwise), change your ruby version with rbenv:

rbenv global 2.2.0

after install rails you must do this: rbenv rehash, in order to tell rbenv to see rails as executable.

follow this tutorial to set up Ruby and Ruby on Rails in your machine: https://gorails.com/setup/osx/10.10-yosemite

Note: In my case. after install rbenv the command rbenv global 2.2.0 doesn't affect my current ruby version (ruby -v still be the previous one). I fix this issue reinstalling rbenv and run this command:

# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile

immediately afterwards, as explained above in the tutorial.

leobelizquierdo
  • 1,648
  • 12
  • 20