删掉旧Xcode后,git突然用不了

我把Xcode8删掉,留下Xcode9,结果Git用不了了。

我想克隆远程一个东西,报错:

xcrun: error: active developer path ("/Applications/Xcode8.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.

意思就是Xcode8.app/Contents/Developer这个文件夹不存在了(因为我已经删掉了),要用sudo xcode-select --switch path/to/Xcode.app这种命令来指定一个你想要用命令行开发工具的Xcode。

最终解决方法:sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer

要切换到的路径,也就是把错题提示中已经不存在的那个路径/Applications/Xcode8.app/Contents/Developer 中的 8给去掉就行了。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. InValid Device State 原因:同时安装了Xcode7和Xcode8等多个版本,在交替使用的...
    梧雨北辰阅读 8,664评论 0 7
  • 常用插件: 获取Xcode的uuid:defaults read /Applications/Xcode.app/...
    nenhall阅读 4,954评论 0 0
  • 之前安装了Xcode8-beta版,新下载了Xcode9之后就把beta版删了,结果在使用cocoapods、ho...
    图南狗阅读 14,004评论 0 3
  • 放一篇之前一直在私人笔记里的参考,也就是个参考手册,用到的时候回来看看。 ‘$’ 作为引用关键字 ex:$PROJ...
    SMThree阅读 9,414评论 0 13
  • 我还是比较喜好晴天的, 因为晴天我就不用想那么多有用的和没用的事了。 但是却偏偏赶上了三月的梅雨时节, 所以, 有...
    草芥人阅读 1,371评论 0 0