美文网首页
cocoapods新安装 2020-04-28

cocoapods新安装 2020-04-28

作者: d_dong_q | 来源:发表于2021-03-04 09:27 被阅读0次

我发现这个不管修改或者安装多少次,下次还是会出现不同的问题,所以参照网上的教程记录一下吧

1,查看一下ruby的版本

ruby -v

2,升级ruby

$gem update --system这个会报错,好像是没有权限

网上搜到sudo gem update --system这个

还是报错

ERROR:  While executing gem ... (Errno::EPERM)

    Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/gem

又找了一下这个

sudo gem install -n /usr/local/bin cocoapods

这次对了gems installed 安装成功

3, 更换Ruby镜像

查询一下ruby源gem sources -l

*** CURRENT SOURCES ***

https://rubygems.org/

这个是国外的,在中国是要被屏蔽的,所以要替换为国内的源

移除国外的源gem sources --remove https://rubygems.org/

添加国内的源gem sources -a https://gems.ruby-china.org/

我用了一下这个不对 gem sources -a https://gems.ruby-china.org/

报错:Error fetching https://gems.ruby-china.org/:

bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)

另外找了这个gem sources --add https://gems.ruby-china.com/

成功了

验证ruby源gem sources -l

*** CURRENT SOURCES ***

https://gems.ruby-china.com/

验证成功了,已替换国内的源

4,安装CocoaPods

sudo gem install cocoapods

报错:网上说是一些系统权限的原因

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

    You don't have write permissions for the /usr/bin directory.

改为这个:sudo gem install -n /usr/local/bin cocoapods

1 gem installed 安装成功

5,更新本地库

pod setup

据说很慢,明天再装吧。

不知道为什么pod setup后特快,一两分钟的样子。。。

pod setup完成

相关文章

网友评论

      本文标题:cocoapods新安装 2020-04-28

      本文链接:https://www.haomeiwen.com/subject/jglbwhtx.html