首页 > 其他 > 详细

cocoapods的安装

时间:2019-08-17 20:58:37      阅读:122      评论:0      收藏:0      [点我收藏+]

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
若出现以下错误请参照该图所示:
      技术分享图片                                           

cocoapods的安装

原文:https://www.cnblogs.com/sdx-highlight/p/11370073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!