Xcode路徑改變導致CocoaPods報錯的解決辦法

這幾天心血來潮,更新了下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>

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容