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一定要安装最新版本哈。
有一步小疏忽,都会导致异常,细心检查,确保每一步都不异常才行。
相关推荐
恋猫de小郭17 小时前
Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
android·flutter·ios
点金石游戏出海1 天前
每周资讯 | Krafton斥资750亿日元收购日本动画公司ADK;《崩坏:星穹铁道》新版本首日登顶iOS畅销榜
游戏·ios·业界资讯·apple·崩坏星穹铁道
旷世奇才李先生1 天前
Swift 安装使用教程
开发语言·ios·swift
90后的晨仔1 天前
Xcode16报错: SDK does not contain 'libarclite' at the path '/Applicati
ios
finger244801 天前
谈一谈iOS线程管理
ios·objective-c
Digitally1 天前
如何将大型视频文件从 iPhone 传输到 PC
ios·iphone
梅名智1 天前
IOS 蓝牙连接
macos·ios·cocoa
美狐美颜sdk1 天前
跨平台直播美颜SDK集成实录:Android/iOS如何适配贴纸功能
android·人工智能·ios·架构·音视频·美颜sdk·第三方美颜sdk
恋猫de小郭2 天前
Meta 宣布加入 Kotlin 基金会,将为 Kotlin 和 Android 生态提供全新支持
android·开发语言·ios·kotlin
泓博2 天前
Objective-c把字符解析成字典
开发语言·ios·objective-c