xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at[转载]

今天在添加友盟统计的podfile

pod install报错了:

bogon:Children songximing$ pod install
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version` ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
") (RuntimeError)
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:130:in `verify_minimum_git_version!'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:49:in `run'
    from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'

原因是升级了macOS Sierra 版本之后,command line tools 工具没有用,
google了一下,在stackoverflow.com上面找到了问题的解决方法。

xcode-select --install

控制台输入以上代码下载xcode命令行工具,就可以完美解决问题了(不会帮你安装xcode)。

原网页:
https://stackoverflow.com/questions/32893412/command-line-tools-not-working-os-x-el-capitan-macos-sierra/32894314#32894314

https://blog.csdn.net/Winter_chen001/article/details/77726456

原文地址:https://www.cnblogs.com/tufei7/p/10136698.html