Cocoapods安装-适用于M1/M2 -- 2023年10月9日

前序安装步骤参考这个文章即可,简单明了。 # CocoaPods安装方法-2023.09.15

我讲几个我安装过程中遇到的问题:

不管报什么错误,先去严格检查这三个东西安装好没有!!!
不管报什么错误,先去严格检查这三个东西安装好没有!!!
不管报什么错误,先去严格检查这三个东西安装好没有!!!

rust 复制代码
1、Xcode
2、Command Line Tools for Xcode
3、Homebrew 

可能的报错情况:

1、执行➜ rvm install ruby-3.2.2 报错了。。。

a.首先确保homebrew updatehomebrew doctor 都成功了,执行提示这个了Your system is ready to brew.,没有就在回去安装.

另外最新homebrew 安装完了还要执行两个命令:

bash 复制代码
echo "eval $(/opt/homebrew/bin/brew shellenv)" >> ~/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)

b.去xcode -> setting-> locations检查看Command Line Tools有没有安装,路径对不对!!

前面都没问题了,如果还报错误,可能的错误信息如下。

报错类似如下:Error running '__rvm_make -j8' 或者openssl 错误

ruby-3.2.2 复制代码
Searching for binary rubies, this might take some time.
DNo binary rubies available for: osx/14.0/arm64/ruby-3.2.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/[email protected]/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/eddie/.rvm/rubies/ruby-3.2.2, this may take a while depending on your cpu(s)...
ruby-3.2.2 - #downloading ruby-3.2.2, this may take a while depending on your connection...
ruby-3.2.2 - #extracting ruby-3.2.2 to /Users/eddie/.rvm/src/ruby-3.2.2 - please wait
ruby-3.2.2 - #configuring - please wait
ruby-3.2.2 - #post-configuration - please wait
ruby-3.2.2 - #compiling - please wait
Error running '__rvm_make -j8',
please read /Users/eddie/.rvm/log/1696846129_ruby-3.2.2/make.log

There has been an error while running make. Halting the installation.
执行以下命令修复:
css 复制代码
rvm reinstall 3.2.2 --with-openssl-dir=$(brew --prefix openssl) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml) --disable-dtrace --disable-docs
2、都安装成功后,执行pod 命令时报错类似:
javascript 复制代码
undefined method `deprecator' for ActiveSupport:Module ( **NoMethodError** )

/Users/eddie/.rvm/rubies/ruby-3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-7.1.0/lib/active_support/core_ext/array/conversions.rb:108:in <class:Array>': **undefined method deprecator' for ActiveSupport:Module (** NoMethodError )

deprecate to_default_s: :to_s, deprecator: ActiveSupport.deprecator ^^^^^^^^^^^

Did you mean? deprecate_constant

解决方法:

我这里使用的是1.13.0 pod版本!!!

先执行命令:

复制代码
sudo gem uninstall activesupport

提示:

csharp 复制代码
You have requested to uninstall the gem:
activesupport-7.1.0

cocoapods-core-1.13.0 depends on activesupport (>= 5.0, < 8)

If you remove this gem, these dependencies will not be met.

Continue with Uninstall? [yN]  y

Successfully uninstalled activesupport-7.1.0

然后再执行这个命令:

复制代码
sudo gem install activesupport -v 7.0.8

提示:

Fetching 复制代码
Successfully installed activesupport-7.0.8

Parsing documentation for activesupport-7.0.8

Installing ri documentation for activesupport-7.0.8

Done installing documentation for activesupport after 0 seconds

1 gem installed

在试试pod 命令应该就可以了。。。

PS:暂时就记得这几个问题了,其他想起来再补充。 Ruby一定要安装最新版本哈。
有一步小疏忽,都会导致异常,细心检查,确保每一步都不异常才行。
相关推荐
pop_xiaoli6 小时前
OC—UI学习-2
学习·ui·ios
90后的晨仔9 小时前
git 命令汇总
ios
liucan23312 小时前
JS执行速度似乎并不比Swift或者C语言慢
前端·ios
安和昂14 小时前
【iOS】 Block再学习
学习·ios·cocoa
pop_xiaoli14 小时前
OC学习—命名规范
学习·ios
Digitally19 小时前
如何在没有 iTunes 的情况下备份 iPhone
ios·iphone
刘_小_二20 小时前
iOS用Xib 之三等分以及多等分思路
ios
season_zhu21 小时前
Swift:优雅又强大的语法糖——Then库
ios·架构·swift
I烟雨云渊T1 天前
iOS 门店营收表格功能的实现
ios
明月看潮生1 天前
青少年编程与数学 01-011 系统软件简介 07 iOS操作系统
ios·青少年编程·操作系统·系统软件