使用 Apple Silicon 的 Mac 别用 gen 来安装 CocoaPods

新买的 Mac Studio 还未安装过 CocoaPods,因为最近开发的项目都是用 Swift Package Manager。目前仍然有很多项目是使用 CocoaPods,今天从 GitHub 上 Clone 了一个 App 就是使用 CocoaPods。我的一般都是直接安装官网的方式去安装,没必要百度和 Google,但是安装官网的安装命令 sudo gem install cocoapods 安装,是能安装成功的,但是使用时却报错了:

1
2
3
4
5
6
7
8
9
10
11
12
$ pod install
Analyzing dependencies
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x00000001046b4000
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]

-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
Read more

Error installing cocoapods: cocoapods-core requires Ruby version >= 2.6. The current ruby version is 2.5.8.224.

Cocoapods 依赖 Ruby,Ruby 我是用 rvm 管理的,rvm 更新又遇到报错:Could not download rvm-installer, please report to https://github.com/rvm/rvm/issues
使用 curl 又遇到报错:curl: (60) SSL certificate problem: certificate has expired

问题最终也解决了,好事多磨吧!
遇到这类问题,不能急,需要耐心的按照它的报错信息去一步步解决就行!