0x01 缘起
在使用HomeBrew
安装CoCoaPods
后,在XCode
根目录使用命令pod init
后,出现错误:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
/Applications/CocoaPods.app/Contents/Resources/bundle/bin/pod init
### Report
* What did you do?
* What did you expect to happen?
* What happened instead?
### Stack
CocoaPods : 1.5.2
Ruby : ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-darwin15]
RubyGems : 2.6.8
Host : macOS 14.6.1 (23G93)
Xcode : ()
Git : git version 2.6.2
Ruby lib dir : /Applications/CocoaPods.app/Contents/Resources/bundle/lib
Repositories :
### Plugins
cocoapods-check : 1.0.0
cocoapods-deintegrate : 1.0.2
cocoapods-plugins : 1.0.0
cocoapods-plugins-install : 0.0.1
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.3.0
cocoapods-try : 1.1.0
### Error
RuntimeError - [Xcodeproj] Unknown object version.
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:218:in `initialize_from_file'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/xcodeproj-1.5.8/lib/xcodeproj/project.rb:103:in `open'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/command/init.rb:41:in `validate!'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/claide-1.0.2/lib/claide/command.rb:333:in `run'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/lib/cocoapods/command.rb:52:in `run'
/Applications/CocoaPods.app/Contents/Resources/bundle/lib/ruby/gems/2.2.0/gems/cocoapods-1.5.2/bin/pod:55:in `<top (required)>'
/Applications/CocoaPods.app/Contents/Resources/bundle/bin/pod:22:in `load'
/Applications/CocoaPods.app/Contents/Resources/bundle/bin/pod:22:in `<main>'
――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=%5BXcodeproj%5D+Unknown+object+version.&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- RuntimeError - `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup` from attributes: `{"isa"=>"PBXFileSystemSynchronizedRootGroup", "exceptions"=>["50D3DB512CBDC46700277254"], "path"=>"RabbitPaletteChallenge", "sourceTree"=>"<group>"}`
https://github.com/CocoaPods/CocoaPods/issues/12634 [open] [0 comments]
21 hours ago
- RuntimeError - [Xcodeproj] Unknown object version (63).: what is this?
https://github.com/CocoaPods/CocoaPods/issues/12348 [open] [14 comments]
4 days ago
- `PBXGroup` attempted to initialize an object with unknown ISA `PBXFileSystemSynchronizedRootGroup`
https://github.com/CocoaPods/CocoaPods/issues/12456 [open] [63 comments]
a day ago
and 112 more at:
https://github.com/cocoapods/cocoapods/search?q=%5BXcodeproj%5D%20Unknown%20object%20version.&type=Issues&utf8=✓
总结:出现了RuntimeError - [Xcodeproj] Unknown object version.
错误.
0x01 解决方案
在stackoverflow
中某一回答说, 卸载Brew
安装的CoCoaPods
, 使用官方命令安装: sudo gem install cocoapods -V
.
在使用命令时, 请设置gem的源到国内, 参考: 解决安装不动:
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
在安装的过程中可能会提示缺少某某环境, 按照提示安装即可, 本文所安装的环境有:
sudo gem install drb -v 2.0.6 -V
sudo gem install activesupport -v 6.1.7.8 -V
0x02 系统环境
- CPU: Apple M1
- MacOS: 14.6.1 (23G93)
0x03 参考资料
- https://blog.youkuaiyun.com/adojayfan/article/details/113611145
- https://stackoverflow.com/questions/71546216/pod-init-cause-runtimeerror-xcodeproj-unknown-object-version