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/openssl@1.1/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一定要安装最新版本哈。
有一步小疏忽,都会导致异常,细心检查,确保每一步都不异常才行。
相关推荐
missmisslulu17 小时前
电容笔值得买吗?2024精选盘点推荐五大惊艳平替电容笔!
学习·ios·电脑·平板
GEEKVIP18 小时前
手机使用技巧:8 个 Android 锁屏移除工具 [解锁 Android]
android·macos·ios·智能手机·电脑·手机·iphone
GEEKVIP18 小时前
如何在 Windows 10 上恢复未保存/删除的 Word 文档
macos·ios·智能手机·电脑·word·笔记本电脑·iphone
奇客软件19 小时前
iPhone使用技巧:如何恢复变砖的 iPhone 或 iPad
数码相机·macos·ios·电脑·笔记本电脑·iphone·ipad
奇客软件2 天前
如何从相机的记忆棒(存储卡)中恢复丢失照片
深度学习·数码相机·ios·智能手机·电脑·笔记本电脑·iphone
GEEKVIP2 天前
如何修复变砖的手机并恢复丢失的数据
macos·ios·智能手机·word·手机·笔记本电脑·iphone
一丝晨光2 天前
继承、Lambda、Objective-C和Swift
开发语言·macos·ios·objective-c·swift·继承·lambda
GEEKVIP3 天前
iPhone/iPad技巧:如何解锁锁定的 iPhone 或 iPad
windows·macos·ios·智能手机·笔记本电脑·iphone·ipad
KWMax3 天前
RxSwift系列(二)操作符
ios·swift·rxswift
Mamong3 天前
Swift并发笔记
开发语言·ios·swift