Your Ruby version is 2.6.0, but your Gemfile specified 2.5.0

10,177

Solution 1

Run

gem install bundler

or

gem update bundler 

which may fix your problem.

Solution 2

I'm using macOS and managed to solve this problem by using rvm first to install the desired ruby version (2.5.7 in my case).

Step-by-step:

  • Install rvm from rvm.io - rvm version may be udpated with:
rvm get head
  • Add rvm to your shell configuration, e.g. ~/.bash_profile:
PATH=$PATH:$HOME/.rvm/bin
source /Users/<YOUR_USER_NAME>/.rvm/scripts/rvm
  • Using rvm, install new Ruby version:
rvm install ruby-2.5.7
  • Set the current/default version:
rvm use ruby-2.5.7 --default
  • Modify your Gemfile to use the new Ruby version. E.g.:
ruby '2.5.7'
  • Refresh the current Ruby version based on ./Gemfile by running:
rvm reload
  • After installing a new version, from your project dir do:
gem install bundler
bundle update
Share:
10,177

Related videos on Youtube

bilal
Author by

bilal

Updated on June 04, 2022

Comments

  • bilal
    bilal almost 2 years

    Having trouble doing bundle. My project is using 2.5.0 but every time i do ruby -v it gives me ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]

    I am using rbenv and my rbenv local is 2.5.0 and rbenv global is 2.5.0

    Every time I do Bundle gives me an error Your Ruby version is 2.6.0, but your Gemfile specified 2.5.0

    I have tried gem install bundler but it doesn't solves the problem.

    source 'http://rubygems.org'
    
    ruby '2.5.0'
    gem 'rails', '5.0'
    

    and my .ruby-version is also 2.5.0

    • nerding_it
      nerding_it over 5 years
      Do you mentioned any ruby version in your gemfile? Something like ruby '2.0.0', :patchlevel => '353' in your Gemfile
    • bilal
      bilal over 5 years
      just updated my question and yes i do mention ruby version in gemfile
    • mogbee
      mogbee over 5 years
      Did you add "export PATH="$HOME/.rbenv/bin:$PATH" in your .bashrc or etc?
  • bilal
    bilal over 5 years
    just deleted the Gemfile.lock and tried to run bundle install and got Your Ruby version is 2.6.0, but your Gemfile specified 2.5.0