cocoapods安装 mac 10.12.2

1、gem sources -l #(查看当前ruby的源)

2、gem sources --remove https://rubygems.org/ #(移除当前ruby的源)

    执行结果:https://rubygems.org/ removed from sources

3、gem sources -a https://rubygems-china.oss.aliyuncs.com #(设置当前ruby的源为我天朝的)

      执行结果:https://rubygems-china.oss.aliyuncs.com added to sources  (特别注意:https, 不是http)

4、sudo gem install -n /usr/local/bin cocoapods
 安装cocoapods 

执行结果:

Password:

Successfully installed cocoapods-1.1.1

Parsing documentation for cocoapods-1.1.1

1 gem installed

5、测试一下执行pod search afnetworking

接下来卡在Setting up CocoaPods master repo这里老半天,我给取消了执行,

6、然后执行了pod setup

       到这里:

Ignoring bigdecimal-1.2.7 because its extensions are not built.  Try: gem pristine bigdecimal --version 1.2.7

Setting up CocoaPods master repo

见到Setting up CocoaPods master repo,这一步要看你的网络环境了,快了1个小时,慢了那就慢慢等,有可能一个下午都下不完,总之别着急。

下载成功后会显示:

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

Setup completed

关键是看到 Setup completed,这就说明安装成了吗,至于上面的信息是告诉你他们有一个1.2.0.beta.1的可用版本,用sudo gem install cocoapods --pre这句话去更新,我一般忽略,因为还是测试阶段

7、 接下来你可以试试pod search afnetworking

人家会提示你这个:Creating search index for spec repo 'master'..别着急,慢慢等一会儿他就会这样:

Creating search index for spec repo 'master'.. Done!

Creating search index for spec repo 'Specs'..,还是别着急再等一会儿,让下面这句话把事儿办完,那就是这样的:

Creating search index for spec repo 'master'.. Done!

Creating search index for spec repo 'Specs'.. Done!

然后就会立马给你打印一大堆你要的搜索的东西,所以,综上:第一次使用pod search 的时候 ,会有些慢,因为要“两个创建”,之后当你搜索的时候那都是秒出。

好了,就到这儿,不问太多为什么,就这走一遍,可以用了就行了。正所谓,好读书,不求甚解。还不如,采菊东篱下,悠然见南山。祝各位处理新的cocoapods顺利。

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