cocoapods 更新

Posted step by step,go along

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cocoapods 更新相关的知识,希望对你有一定的参考价值。

总共就下面几个命令行

sudo gem update --system
gem sources --remove https://rubygems.or
gem source -a https://gems.ruby-china.org/
sudo gem install -n /usr/local/bin cocoapods
pod setup
pod --version
pod search AFNetWorking

升级Ruby环境

gem update --system
若报错 
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

则把上面的命令行换成
sudo gem update --system

更换Ruby镜像

// 检查现有 Ruby镜像
gem sources -l
如果结果是 
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
就不需要替换了,否则就要替换,执行下面命令
// 移除现有镜像
gem sources --remove https://rubygems.or
// 添加国内镜像
gem source -a https://gems.ruby-china.org/
// 检查是否替换成功
gem sources -l

安装 Cocoapods

sudo gem install cocoapods
若出现
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/bin directory.
则换成下面的命令行
sudo gem install -n /usr/local/bin cocoapods

建立索引库

pod setup

查看版本

pod --version

以上是关于cocoapods 更新的主要内容,如果未能解决你的问题,请参考以下文章

cocoapods-Cocoapods上的库怎么更新

cocoaPods 更新替代指令

更新 cocoapods 出现如下错误:

Cocoapods 0.39.0 更新错误

填坑系列之更新CocoaPods

iOS-Cocoapods更新不及时