Mac git xcrun: error: active developer path



 

Mac卸载Xcode后运行git 命令报如下异常:

重新使用brew install git 提示git 已经存在

-> git
xcrun: error: active developer path 
("/Applications/Xcode.app/Contents/Developer") 
does not exist, use `xcode-select --switch path/to/Xcode.app` 
to specify the Xcode that you wish to use for command line 
developer tools (or see `man xcode-select`)

解决办法

  1. xcode-select --install  # 单独安装CommandLineTools,不需要Xcode

  2. sudo xcode-select --switch /Library/Developer/CommandLineTools  # 指定路径

再执行 git,显示OK了。

-> git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]

 

猜你喜欢

转载自bioubiou.iteye.com/blog/2391946