brew报错: Git must be installed and in your PATH

问题描述:
在Mac上使用brew时报错

/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize’: Version value must be a string; got a NilClass () (TypeError)
Error: Git must be installed and in your PATH!


解决历程:

在brew install和brew update等命令时均会出现以上报错1信息。

百度之后决定采取brew update-reset来尝试解决,得到报错2:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

对于报错2通过xcode-select --install解决。
再输入brew update-reset得到以下网络报错3:fatal: unable to access ’https://github.com/Homebrew/brew/’: LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

上述命令由于下载过慢被我手动kill,搜索如何修改源加速,参考https://blog.csdn.net/H_WeiC/article/details/107857302

修改为中科大源之后,解决了报错3和报错1,brew变为正常,可正常install包。

总结;
修改brew源可解决该报错。

你可能感兴趣的:(bug,git,macos,brew)