安装cocoapods后sudo gem install cocoapods
,尝试运行" pod setup
"会返回此错误:
Could not find 'cocoapods' (>= 0) among 64 total gem(s) (Gem::LoadError)
"sudo gem install cocoapods"的输出:
CHANGELOG: [CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.28.0...0.29.0) • [CocoaPods-core](https://github.com/CocoaPods/Core/compare/0.28.0...0.29.0) • [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader/compare/0.2.0...0.3.0) [ bug/enhancement notes removed for brevity] Successfully installed cocoapods-0.29.0 Parsing documentation for cocoapods-0.29.0 1 gem installed
当我列出安装的宝石时,我没有在我的本地宝石中看到cocoapods,但我确实看到/usr/local/Cellar/ruby/2.0.0-p0/bin中列出了'pod'.
系统配置:
Mac OS 10.9 (upgraded from 10.8) Xcode: 5.0.2 (upgrade from 4.x) Ruby path: /usr/local/Cellar/ruby/2.0.0-p0
我怎样才能让cocopods为我工作?
对我来说是
sudo gem install cocoapods
从终端卸载并重新安装CocoaPods为我解决了这个问题(有关更多信息,请参阅CocoaPods文档):
gem uninstall cocoapods gem install cocoapods
尝试:
sudo pod setup
由于您安装了cocoapods作为主管(sudo),因此主管可以看到您无法看到的文件.
这也意味着在将pod添加到podFile后,您还需要运行
sudo pod install
代替
pod install
最终撤销可可豆荚的sudo安装并使用RVM可能会更好.
使用RVM,您可以拥有不同版本的gem集(包括不同版本的cocoapod,如果需要).通过这条路线,您可以绕过必须以sudo运行pod命令.