In the past I've worked on projects where the .ruby-version
checked into git specifies a ruby version not recognized by rbenv. Typically this can happen when the ruby version is specified with patch version while rbenv omits it.
Consider a .ruby-version
file containing 2.1.3p242
. This version is listed as 2.1.3
by rbenv (while RVM and others may list it differently), and it isn't recognized due to the patch version (though the version in rbenv is actually 2.1.3p242
). There's a plugin called rbenv-aliases that addresses this problem.
You can install the plugin with the following commands:
Then, running the command:
will cause rbenv to recognize 2.1.3p242
and set the ruby version to 2.1.3.
However, this plugin must be used with caution. You could say rbenv alias 2.1.3 1.8.7
, which is a lie! The plugin comes with a command for removing any incorrect aliases rbenv unalias 2.1.3
.