1. 程式人生 > >MAC 升級到10.14 mojave beta之後git無法使用解決方案

MAC 升級到10.14 mojave beta之後git無法使用解決方案

MAC 升級到10.14 mojave之後git無法使用解決方案

這幾天google用不了只能靠百度了,首先查到原因是因為每次大版本升級之後,xcode會被解除安裝,而我本來就沒有想xcode,又瞭解了一下,不是xcode而是CommandLineTools,跟xcode有一定關係,git這種命令列工具依賴於CommandLineTools。
於是按照教程執行
`xcode-select --install
然而安裝的時候提示伺服器上找不到軟體,這beta版還真是夠beta的。
繼續百度,找到一部落格說重新安裝最新版xcode(上面一條命令安裝的時候是會彈出安裝xcode的選項的),於是乎安裝xcode,居然有5個多G,安裝好之後再執行上面命令,依然不行。
本來打算放棄,等更新的,後來實在不方便又搜了一下,想看看能不能手動安裝CommandLineTools,然後在V2EX上找到一句有用的話
安裝 brew 後執行 brew doctor 命令後會自動提示你安裝的


執行brew doctor之後果然出來很多warning,擷取其中一段

Warning: Xcode alone is not sufficient on Dunno.
Install the Command Line Tools:
  xcode-select --install


Warning: Ruby version 2.3.6 is unsupported on 10.14. Homebrew
is developed and tested on Ruby 2.3.3, and may not work correctly
on other Rubies. Patches are accepted as
long as they don't cause breakage on supported Rubies. Warning: Your Xcode is configured with an invalid path. You should change it to the correct path: sudo xcode-select -switch /Applications/Xcode.app

其中的sudo xcode-select -switch /Applications/Xcode.app命令看起來像是這個問題的解決方案,執行之後果然git恢復了,找時間再把臃腫的xcode解除安裝掉

2018.06.11更新:
不知道什麼時候又用不了了,然後XCODE也不見了,沒了xcode上面那個方法也不行了,於是又重新下載安裝了一遍xcode,安裝完之後git直接就能用了。
另外TftpServer的GUI版不好用了,不知道跟這個有沒有關係。,