macOS Catalina 10.15.4 rbenv ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
I wanted to use a newer version than the currently installed Ruby version, so switch the version with rbenv.
//Although it is written in the rbenv head family, it needs to be initialized. Bash to finish at login_Write in profile
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
//When you install rbenv, ruby-I think build was installed by dependency resolution, but I specified it just in case
$ brew install rbenv ruby-build
//List of installable versions
$ rbenv install -l
2.5.8
2.6.6
2.7.1
jruby-9.2.11.1
maglev-1.0.0
mruby-2.1.0
rbx-4.15
truffleruby-20.1.0
// install
$ rbenv install 2.7.1
//At this time, ruby's PATH via rbenv refers to the previous one. So the version at this point is 2.6.3
$ rbenv which ruby
/usr/bin/ruby
//Those who are not rbenv ruby are looking at rbenv ruby properly
$ which ruby
/Users/your_account/.rbenv/shims/ruby
//When reflecting in local (current directory)
$ rbenv local 2.7.1
//Reflected in shims
$ rbenv rehash
$ rbenv which ruby
/Users/your_account/.rbenv/versions/2.7.1/bin/ruby
that's all
Recommended Posts