user3063045 user3063045 -4 years ago 112
Ruby Question

Rails Seeing Incorrect Ruby Version

I've built a Rails 5 app and it's working great but I'd like to change the Ruby version I'm running it on. I'm using RVM 1.27.0 on Ubuntu 16.04. I copied the app folder to a different path and changed the versions on .ruby_version and my Gemfile:


source ''
ruby "2.2.2"



Once I updated these I moved out and back into the folder and ran a ruby -v:

ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

I then ran a bundle install and everything installed without error.

However, when I ran rake -T I get this:

Your Ruby version is 2.3.1, but your Gemfile specified 2.2.2.

My $PATH looks good:


What am I missing? Where is Rails pulling the Ruby version from? How can I fix this?

Answer Source

You're using a system bundler which is why you're seeing a different version of ruby. All you need to do is install bundler under your current ruby version:

gem install bundler
bundle install

Once you do a bundle install you'll get the gem's built for the correct ruby version.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download