這幾天心血來潮,更新了下Mac系統(tǒng),然后裝了下Xcode8裝逼,接下來就懵逼了。
由于之前的Xcode是7.1的一直沒升級,本想體驗體驗Xcode8的,所以裝完Xcode8之后Xcode7.1也沒有刪掉,一直兩個Xcode一起用著,用了幾天之后覺得Xcode8挺穩(wěn)定的,于是就刪了Xcode7,故事由此開始了。
刪了Xcode7的幾天后,發(fā)現(xiàn)Xcode8 bug還是蠻多的,不是很穩(wěn)定,并且大家都不怎么推薦這么早就使用Xcode8,于是忍痛割愛(要知道這可是我下了好幾個小時才下下來的?。┌裍code8刪了準備用回Xcode7.1。于是我就從廢紙簍里恢復了幾天前刪除了的Xcode7.1.慶幸竟然還能用(暗暗竊喜).
今天由于要新增一個第三方,所以我很熟練的vim Podfile
巴拉巴拉巴拉然后再 pod install,接下來就懵逼了。。。。
報如下錯誤:
Setting up CocoaPods master repo
$ /usr/bin/git remote set-url origin https://github.com/CocoaPods/Specs.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`)
[!] 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/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`)
[!] Failed: /usr/bin/git checkout master
[!] 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`.
試了幾次都不行,又換pod update還是不行,于是我開始懷疑是不是COcoaPods炸了,還是我升級了系統(tǒng)之后炸了。。。。想想不科學,應該是XCode的問題,仔細閱讀錯誤(原諒我英文差),貌似看懂了那么一點,可能是我刪了XCode又恢復導致的。就這么一百度果然還真是的。
一句命令搞定:sudo xcode-select --switch /Applications/Xcode.app(后面的地址直接打開程序把Xcode往這里拖即可)。完事后再pod install。。biubiubiu出現(xiàn)了熟悉的“Analyzing dependencies”字樣,最后提示“Pod installation complete! There are 15 dependencies from the Podfile and 16 total pods installed.”。ok成功了。
以上記錄我遇到的坑爹錯誤,給初次遇到這樣問題的童鞋一點思路,不至于搓手不急(當時CocoaPods不能用我心中一萬個草泥馬崩騰?。?/p>