微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

cocoapods的安装

1、升级Ruby环境

终端输入:$ gem update --system

此时若出现:ERROR:While executing gem......(Gem::FilePermissionError)

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

这是因为你没有权限升级Ruby

此时输入:$ sudo gem update --system

2、 更换 Ruby镜像

(1)、  删除原先的源   

终端输入:$ gem sources --remove https://rubygems.org/ 

(2)、添加新的源

  终端输入:$ gem sources -a https://gems.ruby-china.org

(3)、查看当前镜像

终端输入:$gem sources -l

 如果结果是
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
说明添加成功,否则继续执行$ gem source -a https://gems.ruby-china.com/来添加 3、安装CocoaPods  终端输入:$ sudo gem install cocoapods 如果出现下图1所示的错误

图1  说明没有权限,需要输入  终端输入:$ sudo gem install -n /usr/local/bin cocoapods 安装成功如下图2所示:

图2 如果出现错误:  ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/pod
macdeMBP:test-CocoaPods mac$ sudo gem install -n /usr/local/bin cocoapods
ERROR:  SSL verification error at depth 1: unable to get local issuer certificate (20)
ERROR:  You must add /O=Digital Signature Trust Co./CN=DST Root CA X3 to your local trusted store 出现这个问题,需要更新Ruby环境 【1】安装Homebrew 终端输入:$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
【2】安装rvm 终端输入:$ curl -L get.rvm.io | bash -s stable 【3】装载rvm 终端输入:$ source ~/.rvm/scripts/rvm 【4】重新安装cocoapods 4、终端输入:$pod setup 若出现以下错误请参照该图所示:      

                                           

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐