安装cocoapods(最新流程)
1.Ruby默认源
0. 查看当前ruby源:gem sources -l
1. ruby默认的源和淘宝的源https://ruby.taobao.org/ 都已经不能使用。我们要移除掉这些不能用的ruby源。
gem sources --r https://ruby.taobao.org/
2. 使用新的源 https://gems.ruby-china.org/
gem sources -a https://gems.ruby-china.org/
3. 验证新源是否替换成功
gem sources -l
如果有其他的地址存在,要删除(gem sources --r),最后只留下https://gems.ruby-china.org/
如果有其他的地址存在,要删除,最后只留下https://gems.ruby-china.org/2.安装cocoapods
sudo gem install -n /usr/local/bin cocoapods //OS X EL Capitan以前系统可以使用sudo gem install cocoapods指令
3.报错调整
1.ERROR: While executing gem … (Gem::DependencyError) Unable to resolve dependencies: cocoapods requires cocoapods-core (= 1.2.0), cocoapods-downloader (< 2.0, >= 1.1.3), cocoapods-trunk (< 2.0, >= 1.1.2), molinillo (~> 0.5.5), xcodeproj (< 2.0, >= 1.4.1); activesupport requires thread_safe (>= 0.3.4, ~> 0.3); tzinfo requires thread_safe (~> 0.1)
解决办法:gem update --system
2.ruby源已经确认没问题,但是还是会报一个地址的错误。While executing gem…(OpenSSL::SSL::SSLError)hostname“upyun.gems.ruby-china.org”doesnotmatch the server certificate
ruby源已经确认没问题解决办法:gem sources --remove 报错的http地址upyun.gems.ruby-china.org
3.ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod
解决办法:苹果系统升级OS X EL Capitan后会出现的插件错误,将安装指令 sudo gem install cocoapods ——>改为sudo gem install -n /usr/local/bin cocoapods