Post

pod报Failed to extract git version from `git --version`

参考:
Pod 报错:Failed to extract git version from git --version
ios构建 xcode-select: error: tool xcodebuild requires Xcode 错误

报错:

1
2
3
4
5
6
/opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:128:in git_version': Failed to extract git version from `git --version ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun\n") (RuntimeError)
	from /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
	from /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/lib/cocoapods/command.rb:49:in `run'
	from /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/gems/cocoapods-1.14.3/bin/pod:55:in `<top (required)>'
	from /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/bin/pod:25:in `load'
	from /opt/homebrew/Cellar/cocoapods/1.14.3_1/libexec/bin/pod:25:in `<main>'

解决方案:

1
2
3
4
# 如果没有安装Xcode,直接使用xcode
xcode-select --install
# 如果已经安装了Xcode,则直接使用xcode
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解决方案: 报这个错误的原因是xcode-select不在默认的路径 找到xcode-select的当前路径终端命令行

1
2
3
4
5
6
7
xcode-select --print-path
# 输出: /Library/Developer/CommandLineTools
# 设置xcode-select到指定位置
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ 
# 验证是否设置成功
xcode-select --print-path
# 输出: /Applications/Xcode.app/Contents/Developer

参考:
iOS 苹果推送证书不受信任解决办法
mac证书如果 iOS 苹果推送证书不受信任解决办法 从这个苹果网站将证书下载下来安装即可 https://www.apple.com/certificateauthority/

This post is licensed under CC BY 4.0 by the author.