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一定要安装最新版本哈。
有一步小疏忽,都会导致异常,细心检查,确保每一步都不异常才行。
相关推荐
QuantumLeap丶16 小时前
《Flutter全栈开发实战指南:从零到高级》- 26 -持续集成与部署
android·flutter·ios
2501_9159184119 小时前
TCP 抓包分析在复杂网络问题中的作用,从连接和数据流层面理解系统异常行为
网络·网络协议·tcp/ip·ios·小程序·uni-app·iphone
二流小码农20 小时前
鸿蒙开发:个人开发者如何使用华为账号登录
android·ios·harmonyos
wvy1 天前
Xcode 26还没有适配SceneDelegate的app建议尽早适配
ios
游戏开发爱好者81 天前
苹果 App 上架流程,结合 Xcode、CI 等常见工具
macos·ios·ci/cd·小程序·uni-app·iphone·xcode
前端老白1 天前
webview在微信小程序中,安卓加载失败,IOS正常加载
android·ios·微信小程序·webview
2501_915106321 天前
用 HBuilder 上架 iOS 应用时如何管理Bundle ID、证书与描述文件
android·ios·小程序·https·uni-app·iphone·webview
2501_915909061 天前
资源文件混淆在 iOS 应用安全中的实际价值
android·安全·ios·小程序·uni-app·iphone·webview
2501_915918411 天前
iOS App 性能测试中常被忽略的运行期问题
android·ios·小程序·https·uni-app·iphone·webview
Name_NaN_None1 天前
iPhone怎么投屏到电脑上?
ios·电脑·iphone