Post

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

在使用cocoapods引用第三方库时,报一个奇怪的错,错误如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
MacBook-Pro:StudyMasonry xxx$ 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.

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

1
sudo xcode-select -switch /Applications/Xcode.app
This post is licensed under CC BY 4.0 by the author.