brew doctor
当brew update无法使用时,运行brew doctor,一条条去修改就好。
brew config
Homebrew bottles (binary package) depend on Command Line Tools (CLT) for installation. After an upgrade, CLT should be reinstalled yet it does not mean xcode installation. To check if you have CLT installed?
brew config
If you found CLT: N\A. Follow @carlocab's answer. Run: xcode-select --install, ...
brew -v
检查目录
brew update
brew自身的升级
brew upgrade
各种package的升级
无法升级CLT时候
在公司网络,无法下载command line tools,可以直接从apple官网下载
https://developer.apple.com/download/all/
解决fatal: not in a git directory问题
使用如下命令
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-services
参考
https://stackoverflow.com/questions/9329243/how-to-install-xcode-command-line-tools