macbook m1,m2 安装cocoapods

 1.安装Homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/huwei1024/HomebrewCN/raw/master/Homebrew.sh)"

安装成功

如果出现 zsh: command not found: brew

解决方法如下:

打开终端

1.1)执行执行以下命令: 

 echo "export PATH=$PATH:/opt/homebrew/bin" >> ~/.zprofile

1.2)执行命令:

export PATH=$PATH:/opt/homebrew/bin

1.3)最后执行:

source ~/.zprofile

2.验证你的Ruby镜像是并且仅是ruby-china,执行以下命令查看:

gem sources -l

2.1)查看结果;

  1. *** CURRENT SOURCES ***

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

2.2)  如果不是执行以下代码

移除输入:gem sources --remove https://rubygems.org/

移除后添加源:输入:gem sources --add https://gems.ruby-china.com

查看是否添加成功:输入:gem sources -l

3.安装cocoapods

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

 3.1如果遇到

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

执行一下命令

gem install cocoapods --user-install

查看cocoapods版本:

pod --version

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值