問題及分析 今天做項目的時候,執行pod update報瞭如下錯誤信息: /usr/local/lib/ruby/gems/2.4.0/gems/cocoapods 1.5.3/lib/cocoapods/command.rb:118:in git version sudo xcode select ...
問題及分析
今天做項目的時候,執行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\nUse
sudo xcode-select --switch path/to/Xcode.appto specify the Xcode that you wish to use for command line developer tools, or use
xcode-select --installto install the standalone command line developer tools.\nSee
man 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電子書」免費領取程式員必讀經典電子書。