如果不喜歡用 Xcode 或者因爲存儲不夠用,比如我習慣了VS Code(其實我就是因爲想省存儲),刪除Xcode之後的Git無法使用,回出現以下報錯。
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --ins
tall` to install the standalone command line developer tools.
See `man xcode-select` for more details.
可以看到這裏面apple有叫你做幾個事情,但是...最好別了哈哈哈哈哈哈
=====================================言歸正傳分割線==========================================
首先,到 Git官網 下載,下載完成,安裝成功之後。到以下目錄查看 git 是不是在那裏
cd /usr/local/bin
如果 git 在,則順序執行:
echo "PATH=/usr/local/git/bin:\$PATH" >> ~/.bash_profile
和
source ~/.bash_profile
最後關掉 terminal,重新打開就可以愉快地用 Xcode 以外的 IDE 了。
這種方法對於我這種買了 256GB 存儲 mac 的窮人來說實在是太友好了...啊哈哈哈哈哈哈哈哈哈哈哈
祝你們用得愉快~