/usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in `git_version': Failed to extract git version from `git --version`


問題及分析

今天做項目的時候,執行pod update報了如下錯誤信息:

/usr/local/lib/ruby/gems/2.4.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:118:in git_version': Failed to extract git version from git --version("xcrun: error: active developer path (\"/Users/feiwei/Desktop/Xcode.app/Contents/Developer\") does not exist\nUsesudo xcode-select --switch path/to/Xcode.appto specify the Xcode that you wish to use for command line developer tools, or usexcode-select --installto install the standalone command line developer tools.\nSeeman xcode-select` for more details.\n") (RuntimeError)

粗略一看,應該是找不到git。為什么找不到?首先,有可能沒有安裝git;其次,可能是關聯路徑不對。

解決方案

1.沒有安裝git
可以在終端執行:xcode-select --install。如果你的電腦系統更新了,有可能這個命令解決不了你的問題,那么,這時候需要到git官網下載安裝,下載鏈接https://git-scm.com/download/mac。

2.關聯路徑不對
這個問題可以使用命令:sudo xcode-select --switch /Users/feiwei/Downloads/Xcode.app,其實這個命令就是指定Xcode的安裝目錄。如果你不知道安裝路徑,或者不想用命令,Xcode -->Preferences-->Locations並選擇Command Line Tools,看看是否選擇了當前Xcode版本。

步驟一

步驟二

簡書:https://www.jianshu.com/u/fa72e27b5006
CSDN:https://blog.csdn.net/xiaocaoyu111

掃描二維碼關注公眾號

PS:本文原創發於微信公眾號longyoung,關注並回復「51電子書」免費領取程序員必讀經典電子書。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM