.rbenv / version file describes the ruby version you are currently using.
If you change the version with the
rbenv global x.x.x command etc., the contents of
.rbenv / version will also be rewritten.
[ec2-user@al1-gemlist ~]$ ruby -v ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux] [ec2-user@al1-gemlist ~]$ cat .rbenv/version 2.5.7 [ec2-user@al1-gemlist ~]$ rbenv global 2.5.8 [ec2-user@al1-gemlist ~]$ ruby -v ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-linux] [ec2-user@al1-gemlist ~]$ cat .rbenv/version 2.5.8
Then, what happens if you edit
.rbenv / version with vi?
As a test, change the contents of
.rbenv / version from
[ec2-user@al1-gemlist ~]$ sudo vi .rbenv/version [ec2-user@al1-gemlist ~]$ cat .rbenv/version 2.5.0 [ec2-user@al1-gemlist ~]$ ruby -v ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
You can see that the version of ruby has been changed according to the contents of the file.
Also, if you check with the
rbenv versions command,
[ec2-user@al1-gemlist ~]$ rbenv versions system * 2.5.0 (set by /home/ec2-user/.rbenv/version) 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.6.2
It can be confirmed that this is also 2.5.0.
However, there is one question here. I understand that the version of ruby is displayed as 2.5.0 on the version confirmation command, but it means "Is it changed to 2.5.0 internally?"
As a confirmation method, check the version of the gem called openssl.
This gem is
When ruby is 2.5.8
If ruby is 2.5.0, it will be
(For details, refer to here)
In other words, if the version of openssl is
2.1.0, it can be said that the ruby version has been changed to 2.5.0 internally.
[ec2-user@al1-gemlist ~]$ gem list openssl *** LOCAL GEMS *** openssl (default: 2.1.0)
Therefore, it was confirmed that it could be changed internally.