pod install 出错
一、问题描述
in `to_specs’: Could not find ‘cocoapods’
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in
to_specs': Could not find 'cocoapods' (>= 0) among 13 total gem(s) (Gem::LoadError)
to_spec’
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:ingem'
’
from /usr/local/bin/pod:22:in
二、首先确认下Ruby的版本
MAC自带的Ruby版本一般比较低(记得是2.0.0,查看版本ruby -v
),先升级一下,
1.没有安装homebrew
的话先安装一下
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
2.通过 brew
安装 Ruby
最新版本
brew update
brew install ruby
三、重新安装一下cocoapods
不要使用 sudo gem install cocoapods
,这样的话可能会有一些问题 , 现在解决一下现在的问题 。
1. Uninstall Cocoapods:
sudo gem uninstall cocoapods
2.Install cocoapods without sudo:
gem install cocoapods -V --no-ri --no-rdoc
# V: Verbose; no-ri,no-rdoc: Do not install documentation
3.Set up Cocoapods:
pod setup
四、Should work now
pod install