[Ruby] Final confirmation when the version of ruby does not switch

less than 1 minute read

Target this time

Correctly reflect the version of ruby installed with rbenv.

Expected readership

  • Installed with rbenv
  • Confirmed installed ruby
  • I have a pass
  • rbenv init is described in ~/.zshrc

The work up to here is omitted because there are many good articles.

If you still don’t switch versions, have you completed the steps below?

$rbenv versions
* 2.6.3 (set by /Users/.../.ruby-version)

Who is this .ruby-version?

Quote (when not switched by rbenv) The version set with »rbenv local is recorded in the .ruby-version file in the current directory, and will override the version set with rbenv global as long as you stay in that directory.

The reason why the ruby version did not switch was that the version recorded in ruby-version had priority. If you reach here, the goal is right there.

Finally switch ruby version

$rm .ruby-version
$rbenv global(local) installed ruby version
$rbenv rehash
$ruby -v (should the version switch here)

Thank you


When not switching with rbenv Version does not switch in Ruby rbenv global 2.3.0