如何在MacOS中修复 "你的CLT不支持macOS 11 "的错误

375 阅读1分钟

我最近在使用Homebrew在macOS上安装一个软件包时遇到了这个错误,在我的情况下,rbenv

➜ brew install rbenv

...

Error: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  ~https://developer.apple.com/download/more/~.

Error: An exception occurred within a child process:
  SystemExit: exit

很奇怪!

按照信息中的建议运行softwareupdate --all --install --force ,但没有帮助,所以我运行了sudo rm -rf /Library/Developer/ ,然后是sudo xcode-select --install

就是这样。

这样做之后,brew install rbenv ,工作正常。