之前10.7的系统上运行过cocoapods没有问题。现在系统版本升级到了10.9,尝试使用cocoapods遇到问题,报告了类似下面的错误: Psych::SyntaxError - (/Users/psteinacher/.cocoapods/repos/master/CocoaPods-version.yml): mapping values are not allowed in this context at line 3 column 4 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `block in load_file‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `open‘ /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:299:in `load_file‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:248:in `version_information‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:209:in `repo_compatible?‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/sources_manager.rb:268:in `master_repo_functional?‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:40:in `parse‘ /Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:179:in `parse‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:39:in `parse‘ /Library/Ruby/Gems/2.0.0/gems/claide-0.4.0/lib/claide/command.rb:211:in `run‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/lib/cocoapods/command.rb:52:in `run‘ /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.28.0/bin/pod:24:in `<top (required)>‘ 经过多方尝试,发现执行如下的命令可以解决问题:
$ sudo rm -fr ~/.cocoapods/repos/master $ pod setup 最后推荐一个xcode插件,可以很方便的使用cocoapods。 CocoaPods for Xcode 非常方便的Xcode pods插件。可以很方便的在Xcode通过pods安装各种objective-c第三方库,省去以前还要手动去跑pods命令行的麻烦;此外,还支持通过cocoaDocs来安装库文档。唯一的遗憾是,它目前只支持Xcode5,4版本还用不了。 项目地址:https://github.com/kattrali/cocoapods-xcode-plugin Enjoy it!
一个cocoapods问题的解决,希望能帮助到遇到类似情况的人,码迷,mamicode.com
时间: 2024-10-10 01:14:34