[Mac] Homebrew 無法更新,出現 Git 未安裝的錯誤訊息?

[Mac] Homebrew 無法更新,出現 Git 未安裝的錯誤訊息?

最近想要更新 Mac 上的 Homebrew 時,

突然出現 Git must be installed and in your PATH! 的錯誤訊息:

testuser@localhost ~ $ brew update

Warning: git 2.15.1 is already installed
Error: Git must be installed and in your PATH!


這真是莫名其妙,我的 git 裝的好好的,也可以正常執行…

跑跑看 brew doctor 檢測一下:

testuser@localhost ~ $ brew doctor

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
  brew install git

Warning: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install


訊息的前半部叫我要裝 git => 但我早就裝了

訊息的後半部比較有參考價值 => 叫我要安裝 xcode 的命令列工具~

猜測應該是因為最近 xcode 有更新的關係…

就照著指令安裝 xcode 命令列工具吧:

testuser@localhost ~ $ xcode-select --install

xcode-select: note: install requested for command line developer tools


裝好之後,Homebrew 終於恢復正常啦:

testuser@localhost ~ $ brew doctor

Your system is ready to brew.


(本頁面已被瀏覽過 12 次)