pod的安装以及错误提示处理方法

1.安装RVM ,升级Ruby环境 

(1)ruby -v //查看Ruby版本号

(2)安装RVM

curl -L get.rvm.io | bash -s stable

source ~/.bashrc

source ~/.bash_profile

(3)查看rvm版本号

rvm -v 

显示如下

rvm 1.29.4 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

(4)列出ruby可安装的版本信息

rvm list known

显示如下


(5)安装一个ruby版本(这里我选择的是2.4.1版本,当然你也可以选择其他的

rvm install 2.4.1

(6)设置为默认版本

rvm use 2.4.1 --default

2.更换源(以前的taobao Gems源【https://ruby.taobao.org】已停止维护 ,用https://gems.ruby-china.org/)

(1)sudo gem update --system

gem sources --remove https://rubygems.org/

gem sources -a https://gems.ruby-china.org/

(2)查看源

gem sources -l

如下:

*** CURRENT SOURCES ***

https://gems.ruby-china.org/

3.开始安装

(1)sudo gem install -n /usr/local/bin cocoapods

(2)如果安装了多个Xcode使用下面的命令选择(一般需要选择最近的Xcode版本)

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

(3)安装本地库

pod setup

完成后应该如下

Setting up CocoaPods master repo

  $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress

  Cloning into 'master'...

  remote: Counting objects: 1879515, done.       

  remote: Compressing objects: 100% (321/321), done.       

  Receiving objects:  21% (404525/1879515), 73.70 MiB | 22.00 KiB/

然后就是漫长的等待,当然,网络好的情况下会更快


执行pod setup错误提示:

[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress

Cloning into 'master'...

remote: Counting objects: 2278904, done.       

remote: Compressing objects: 100% (503/503), done.       

error: RPC failed; curl 18 transfer closed with outstanding read data remaining

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

解决方法

<1>

git config --global http.postBuffer 524288000

git config --list //查看列表

<2> 执行Git clone https://git.coding.net/CocoaPods/Specs.git ~/.cocoapods/repos/master和pod setup效果一样,之后在更新。成功率会提高哦

<3>如果一直慢的要死,,,卡的要死,,,网络不给力。。。。直接下载替换吧。。。。。。。。

链接: https://pan.baidu.com/s/1wriINtoLn3LI4Ik_a9NFVg 密码: 8qdq

<4>2021.1.22改,

可直接传到git再克隆到~/.cocoapods/repos/master

(https://gitee.com/wangtongmin/specs.git)

~/.cocoapods/repos/master去到这个目录直接替换,,,,简单粗暴吧。。。哈哈哈!!!

你可能感兴趣的:(pod的安装以及错误提示处理方法)