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一定要安装最新版本哈。
有一步小疏忽,都会导致异常,细心检查,确保每一步都不异常才行。
相关推荐
笑尘pyrotechnic10 小时前
LLDB进阶:使用命令行进行检查
ios·objective-c·cocoa·lldb
z***y86212 小时前
Swift在iOS中的Xcode
ios·xcode·swift
AirDroid_cn13 小时前
iOS 18 后台应用偷跑流量,如何限制?
macos·ios·cocoa
明君8799715 小时前
Flutter 图纸标注功能的实现:踩坑与架构设计
android·ios
江东小bug王16 小时前
深入理解 UINavigationController:生命周期、动画优化与性能调优
ios
Lexiaoyao2017 小时前
Apple StoreKit 2 开发指南
ios·apple
2501_915106321 天前
iOS App 测试工具全景分析,构建从开发调试到线上监控的多阶段工具链体系
android·测试工具·ios·小程序·uni-app·iphone·webview
Digitally2 天前
如何通过蓝牙将联系人从 iPhone 传输到 Android
android·ios·iphone
90后的晨仔2 天前
2025年11月27日年解决隐私清单导致审核总是提示二进制无效的问题
ios
songgeb2 天前
iOS Audio后台模式下能否执行非Audio逻辑
ios·swift