1 今天打算升级CocoaPods时出现的问题
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:318:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 35 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/xurui/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:327:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/pod:22:in `<main>'
2 我在stackoverflow上看到同样的问题,可能是gem的版本问题或者安装路径问题
1 检查一下gem的版本
gem sources -l
2 正常输出结果应该是淘宝镜像
*** CURRENT SOURCES ***
https://ruby.taobao.org/
2.1 由于taobao Gems 源已停止维护,现由 ruby-china 提供镜像服务,所以需要切换一下
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.com/
3 清除gem
sudo gem uninstall --all
4 清除掉gem之后,再卸载CocoaPods
sudo gem install cocoapods
5 最后在重新安装一下CocoaPods
sudo gem install -n /usr/local/bin cocoapods
6 检查一下版本
*****MacBook-Pro:~ haha$ pod --version
0.39.0
参考
http://stackoverflow.com/questions/26795553/cocoapods-installation-setup-error
以下将记录cocoaPods的其他使用问题
安装cocoaPods时太慢
我是切换了清华大学的镜像
cd ~/.cocoapods/repos
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
pod setup
参考地址
Unable to find a pod with name, author, summary, or description matching
Unable to find a pod with name, author, summary, or description matching
删除cocoapods的索引,然后重新search
rm ~/Library/Caches/CocoaPods/search_index.json
pod search AFNetworking
然后触发操作
Creating search index for spec repo '.git'.. Done!
参考地址