Mac Homebrew 损坏修复及用brew 安装gradle
2021-05-19 本文已影响0人
dbasy
最近mac命令行窗口使用brew总是报各种错误。
比如
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: gradle cannot be built with any available compilers.
Install GNU's GCC:
brew install gcc
又比如
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: The following formula
gcc
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install
到目录底下一看,啥时候没了
image.png
那么去官网https://developer.apple.com/download/more/下载,刚开始下载了个
Command_Line_Tools_for_Xcode_12.5.dmg 结果悲剧了 版本不兼容,你们懂了不敢随便升级mac系统,毕竟很多软件是破解的。
官网也没说兼容的mac系统,那就选个发布日期比自己笔记本生产日期相近的版本吧 我是2020的机子,就选了个2020 1月份发布的。我选了Command_Line_Tools_for_Xcode_11.3.1.dmg,运气不错,一把通过
image.png
输入命令检查下能否用了,ok了
brew info
19 kegs, 17,349 files, 278.9MB
装个gradle试试,光下载就好几分钟
brew install gradle
image.png
image.png