rubyの最新を取得しようとして
$ rbenv install --list
をたたいたものの最新バージョンがでてこなかったのでrbenvをupgradeした。
rbenvをupgradeする
まずはおなじみ
$ brew update
upgradeする
$ brew upgrade ruby-build
実行すると以下のエラーになる
実行結果
==> Summary
🍺 /usr/local/Cellar/readline/8.0.1: 48 files, 1.5MB
==> Installing ruby-build
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
CompilerSelectionError: ruby-build cannot be built with any available compilers.
Install GNU's GCC:
brew install gcc
エラーになる。以下を叩けと
$ brew install gcc
以下の結果になる、うーん同じコマンドたたけといわれる。
実行結果
==> Installing gcc
Warning: Building gcc from source:
The bottle needs the Xcode CLT to be installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC:
brew install gcc
ググルとどうやら、以下ををたたけと
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
たたくと上記の表示とダイアログが出るのでダイアログをOKとする。
インストールが完了する。
再度
$ brew install gcc
をたたくと無事成功する。
続いて
$ brew upgrade ruby-build
をたたくと無事成功する。
そして
$ rbenv install --list
をたたくと無事にruby 2.7.0がいた。
参考
この辺調べながらやった、ありがとうございます
https://morizyun.github.io/ruby/rbenv-update-mac-homebrew.html
https://qiita.com/zousaaan3/items/d1d9af1bf55c32ca5fe8
https://qiita.com/wawawa/items/50c2c612b0937f28d92b
https://qiita.com/motofumi/items/0f2e7ae1b852f118fe95