mac xcode卸載后的后遺癥-git無法使用

xcode 卸載后 就出現(xiàn)了 如下情況 git命令失效了,如下報(bào)錯:
xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
問題分析:肯定是xcode自帶了git 導(dǎo)致刪除了無法使用了,所以要修改原git路徑或重新安裝git
一、重新安裝git 具體如下 沒反應(yīng)

MacBook-Pro:~ zhengjie$ brew install git
Error: git: Unsupported special dependency :perl
Error: Git must be installed and in your PATH!
Error: git: Unsupported special dependency :perl

使用更新brew update 也沒用了,如下報(bào)錯:

Error: git: Unsupported special dependency :perl
Error: Git must be installed and in your PATH!

然后折騰安裝 brew install perl吧 結(jié)果git還是沒辦法安裝
二、后來網(wǎng)上找到一種方法 分享給大家:
主要是重置之前的xcode的設(shè)置
注:沒有安裝的需要執(zhí)行安裝(我的mac 已經(jīng)安裝) xcode-select --install
分三步命令 重置->修改路徑指向->打印path路徑 具體如下:

sudo xcode-select -r
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
xcode-select -p

測試git命令:

MacBook-Pro:~ zhengjie$ git --version
git version 2.20.1 (Apple Git-117)

OK,終于git 可以使用了。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容