20161206日更新CocoaPods版本

从网上下载的工程第三方库需要更新,但当我执行pod update时提示以下错误:

[!] The `master` repo requires CocoaPods 1.0.0 -  (currently using 0.39.0)

查看当前CocoaPods版本:

pod --version

0.39.0

说明我们需要更新CocoaPods的版本了

gem source -l
查看当前的镜像
把已有的都进行移除


并只添加这一个镜像
gem source -a https://gems.ruby-china.org
再使用gem source -l查看是否是唯一的镜像
sudo gem install -n /usr/local/bin cocoapods --pre
sudo gem update --system
但是这时候我查看cocoapod的版本还是0.39.0
这时候再去执行
提示错误:
ERROR:  While executing gem ... (URI::InvalidURIError)
    bad URI(is not URI?): ?gems=–pre


执行pod setup
提示错误:
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': SSLRead() return error -9845
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`


按照她的提示,输入:
pod repo update --verbose
这时候貌似要成功了,它会提示:
CocoaPods 1.2.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.2.0.beta.1


再使用命令sudo gem install cocoapods --pre
但又提示错误:
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/pod


再输入:
sudo gem install -n /usr/local/bin cocoapods --pre
就完美的解决问题了

这是因为10.11的系统把pod目录已到了usr文件夹下,可以在finder中前往/usr/local/bin文件夹查看


查看当前cocoapods版本
1.2.0.beta.1、


完美

原文地址:https://www.cnblogs.com/i-am-lvjiazhen/p/6136502.html