运行命令 sudo gem install cocoapods
报错: ERROR: While executing gem ... (OpenSSL::SSL::SSLError) hostname "upyun.gems.ruby-china.org" does not match the server certificate
ERROR: While executing gem ... (OpenSSL::SSL::SSLError) hostname "upyun.gems.ruby-china.org" does not match the server certificate复制代码
原因是 cocoapods 依赖的 gem 版本过低 升级
执行命令 sudo gem update --system
Updating rubygems-updateFetching: rubygems-update-2.6.7.gem (100%)Successfully installed rubygems-update-2.6.7Parsing documentation for rubygems-update-2.6.7Installing ri documentation for rubygems-update-2.6.7Installing darkfish documentation for rubygems-update-2.6.7Installing RubyGems 2.6.7RubyGems 2.6.7 installedParsing documentation for rubygems-2.6.7Installing ri documentation for rubygems-2.6.7=== 2.6.7 / 2016-09-26复制代码
再次运行 sudo gem install cocoapods
报错:While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/xcodeproj
原因:在stackoverflow搜到的解释是这样的,This is happening because Apple has enabled rootless on the new install,也就是说在10.11系统上苹果已经启用无根的安装。
解决方案:如下的命令:sudo gem install -n /usr/local/bin cocoapods
升级成功。