[ruby-on-rails] How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting

I am getting this error while running server, how do I fix this?

enter image description here

This question is related to ruby-on-rails ruby rubygems

The answer is


If you are using rbenv then make sure that you run the "rbenv rehash" command after you set local or global ruby version. It solved the issue for me.

rbenv rehash

I am on Mac OS Sierra. I had to update /etc/paths and add /Users/my.username/.rbenv/shims to the top of the list.


Add the following to your Gemfile

ruby '2.3.0'

If you have already installed 2.2.5 and set as current ruby version, but still showing the same error even if the Ruby version 2.3.0 is not even installed, then just install the bundler.

gem install bundler

and then:

bundle install

Your Gemfile has a line reading

ruby '2.2.5'

Change it to

ruby '2.3.0'

Then run

bundle install

For $ Your Ruby version is 2.3.0, but your Gemfile specified 2.4.1. Changed 2.4.1 in Gemfile to 2.3.0


Two steps worked for me:

gem install bundler

bundle install --redownload # Forces a redownload of all gems on the gemfile, assigning them to the new bundler

it can also be in your capistrano config (Capfile):

set :rbenv_ruby, "2.7.1"

I had this problem but I solved it by installing the version of the ruby that is specified in my gem file using the RVM

    rvm install (ruby version)

After the installation, I use the following command to use the the version that you installed.

    rvm --default use (ruby version)

You have to install bundler by using the following command in order to use the latest version

    gem install bundler 

After the above steps, you can now run following command to install the gems specified on the gemfile

    bundle install

A problem I had on my Mac using rbenv was that when I first set it up, it loaded a bunch of ruby executables in /usr/local/bin - these executables loaded the system ruby, rather than the current version.

If you run

which bundle

And it shows /usr/local/bin/bundle you may have this issue.

Search through /usr/local/bin and delete any files that start with #!/user/bin ruby

Then run

rbenv rehash


Examples related to ruby-on-rails

Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Where do I put a single filter that filters methods in two controllers in Rails Empty brackets '[]' appearing when using .where How to integrate Dart into a Rails app Rails 2.3.4 Persisting Model on Validation Failure How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? Rails: Can't verify CSRF token authenticity when making a POST request Uncaught ReferenceError: React is not defined

Examples related to ruby

Uninitialized Constant MessagesController Embed ruby within URL : Middleman Blog Titlecase all entries into a form_for text field Ruby - ignore "exit" in code Empty brackets '[]' appearing when using .where find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite? How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? How to update Ruby with Homebrew?

Examples related to rubygems

You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting You don't have write permissions for the /var/lib/gems/2.3.0 directory Can't install gems on OS X "El Capitan" How to avoid "cannot load such file -- utils/popen" from homebrew on OSX How can I set a proxy server for gem? How to install CocoaPods? Error while installing json gem 'mkmf.rb can't find header files for ruby' How to downgrade or install an older version of Cocoapods