cocoapods的安装

自己写了个小DEMO,中途想导入一些开源的代码,然而在安装cocoapods的途中屡屡受挫。

其实安装的命令很简单:

gem install cocoapods

然而我的执行结果是这样的:

ERROR:Could not find a valid gem 'cocoapods' (>= 0), here is why:

Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/latest_specs.4.8.gz)

大概的意思就是不能从https://rubygems.org/上下载数据包。

那么问题来了,国内的网络原因导致不能去这里下我们需要的gem,这不是血崩的节奏?

还好有这个:RubyGems 镜像

然后执行命令:

gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/

请确保源只存在一个,所以remove掉原有的rubygems.org

执行:

gem sources -l

结果:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

好了,完事具备只欠东风。

再次执行:

gem install cocoapods

发现

Fetching: i18n-0.7.0.gem (100%)

ERROR:While executing gem ... (Gem::FilePermissionError)

You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

没权限。。加个sudo吧

sudo gem install cocoapods

输入pwd之后

Fetching: i18n-0.7.0.gem (100%)

Successfully installed i18n-0.7.0

一连串的这些东西,ok,大功告成。

你可能感兴趣的:(cocoapods的安装)