ys@mbp ~ % rails -v
Rails 7.0.3
ys@mbp ~ % ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
ys@mbp ~ % which ruby
/Users/ys/.rbenv/shims/ruby
ys@mbp ~ % rbenv install -l
2.6.10
2.7.6
3.0.4
3.1.2
jruby-9.3.7.0
mruby-3.1.0
picoruby-3.0.0
rbx-5.0
truffleruby-22.2.0
truffleruby+graalvm-22.2.0
Only latest stable releases for each Ruby implementation are shown.
Use 'rbenv install --list-all / -L' to show all local versions.
ys@mbp ~ % rbenv install 2.7.6
To follow progress, use 'tail -f /var/folders/6x/5qgd746161767rs9g20q5g8w0000gn/T/ruby-build.20221009070553.56692.log' or pass --verbose
Downloading openssl-1.1.1q.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
Installing openssl-1.1.1q...
patching file test/v3ext.c
Installed openssl-1.1.1q to /Users/ys/.rbenv/versions/2.7.6
Downloading ruby-2.7.6.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.bz2
Installing ruby-2.7.6...
ruby-build: using readline from homebrew
Installed ruby-2.7.6 to /Users/ys/.rbenv/versions/2.7.6
ys@mbp ~ % rbenv versions
system
2.6.8
2.7.6
* 3.0.2 (set by /Users/ys/.rbenv/version)
ys@mbp ~ % rbenv rehash
ys@mbp ~ % rbenv versions
system
2.6.8
2.7.6
* 3.0.2 (set by /Users/ys/.rbenv/version)
ys@mbp ~ % ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
ys@mbp ~ % rbenv global 2.7.6
ys@mbp ~ %
参考サイト
Rubyのバージョン切り替え方法!(Mac用) | 狼読
https://info-wcn.com/ruby-changeversion-mac/
rbenv rehashをちゃんと理解する
https://mogulla3.tech/articles/2020-12-29-01
【Ruby】MacでRubyのインストール&バージョンを変更する方法 | くにぽんず☆きちめきパラダイス
https://kunipon.com/3105