CocoaPods报(The `master` repo is not a git repo.)

在使用cocoapods引用第三方库时,报一个奇怪的错,错误如下:
<pre>
liuhuan-workdeMacBook-Pro:StudyMasonry liuhuan$ pod install –verbose –no-repo-update
Preparing
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)

Setting up CocoaPods master repo
$ /usr/bin/git remote set-url origin https://github.com/CocoaPods/Specs.git
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
[!] Failed: /usr/bin/git remote set-url origin
https://github.com/CocoaPods/Specs.git
$ /usr/bin/git checkout master
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
[!] Failed: /usr/bin/git checkout master
xcrun: error: active developer path (“/Applications/Xcode8.1.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 see man xcode-select)
[!] Unable to add a source with url https://github.com/CocoaPods/Specs.git named master-1.
(The master repo is not a git repo.)
You can try adding it manually in ~/.cocoapods/repos or via pod repo add.
</pre>

根据提示以及百度参考文章CocoaPod install报错 the master repo is not a git repo
(我系统的Xcode.app位置与查找到这篇文章不一样,没有中间那个Develop文件夹)
通过运行下面命令完美解决
sudo xcode-select -switch /Applications/Xcode.app

    原文作者:独孤流
    原文地址: https://www.jianshu.com/p/d14d38c40ba0
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞