xcode-卸载删除xcode后无法使用git
1.官网安装的 git 位置在 /usr/local/git 目录
brew install git
2.xcode 默认会安装 git,位置在 /usr/bin 目录
卸载删除 xcode 后系统无法正确识别 git 位置,报错类似
xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
'git log' failed with code 1:'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 --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.'
3.使用以下命令安装 CommandLineTools,对 xcode 的配置进行重置
// 删除安装目录下的文件
sudo rm -rf /Library/Developer/CommandLineTools
// 安装 xcode-select
xcode-select --install
xcode-select --version
// 重置 CommandLineTools 配置
sudo xcode-select -r
// 配置 CommandLineTools PATH
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
// 打印 CommandLineTools 配置
xcode-select -p
作者:天生帅才 www.zuiyoujie.com
本文版权归作者和博客园共有,如果感觉有用可以随意打赏,感谢支持,欢迎转载




【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具