更新cocoapods 时遇到问题及解决

字数 155阅读 51

运行命令 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-update
Fetching: rubygems-update-2.6.7.gem (100%)
Successfully installed rubygems-update-2.6.7
Parsing documentation for rubygems-update-2.6.7
Installing ri documentation for rubygems-update-2.6.7
Installing darkfish documentation for rubygems-update-2.6.7
Installing RubyGems 2.6.7
RubyGems 2.6.7 installed
Parsing documentation for rubygems-2.6.7
Installing 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

升级成功。

推荐阅读更多精彩内容