`brew upgrade <package>`:“ <package>不能用任何可用的编译器构建”

Red*_*irt 5 ruby macos homebrew ruby-on-rails

例如,我尝试运行brew upgrade ruby-build

失败并显示错误:

CompilerSelectionError: ruby-build cannot be built with any available compilers.
Install GNU's GCC
  brew install gcc
Run Code Online (Sandbox Code Playgroud)

当我跑步时brew install 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
Run Code Online (Sandbox Code Playgroud)

如何升级ruby-build通过brew

Red*_*irt 7

我运行了此命令,它现在可以工作:

$ xcode-select-安装