Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.

安装cocoapods执行$ sudo gem install cocoapods时报错。

解决方法:

1.更新ruby的源

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

gem sources -a https://ruby.taobao.org/

gem sources -l

2.设置git的http代理(也可以设置ssh,两者的区别自己查询)

export http_proxy="http://username:[email protected]:3128/"

3.删除Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

4.安装ruby2.2.2(需要一些时间)

rvm install 2.2.2

5.安装cocoapods

sudo gem install cocoapods

6.pod setup(时间比较长)

如果这个时候报错

Cloning into 'master'...

error: RPC failed; result=56, HTTP code = 200

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

我Google一下可能是代理的问题,但我没改成ssh,我又一次运行了pod setup,它自己就好了,如果再次运行pod setup不能正确执行,请尝试更改代理

你可能感兴趣的:(Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.)