梳理M1芯片Mac mini 执行 pod install 失败Ruby直接崩

Python014

梳理M1芯片Mac mini 执行 pod install 失败Ruby直接崩,第1张

环境:2020款M1芯片Mac mini ,Xcode 13.3.1,Ruby为自带2.6.8

简述:

    刚开始安装时还按照正常逻辑安装cocoapods,执行pod install 时,报Ruby崩溃,让上报错误信息:

You may have encountered a buginthe Ruby interpreter or extension libraries.Bug reports are welcome.For details:https://www.ruby-lang.org/bugreport.html

最后几番折腾,知道是 ffi 相关包执行X86指令集,需要适配M1芯片架构,即arm64指令集

主要涉及Ruby版本,我系统版本Mac OS 12.3.1,ruby版本系统自带2.6.8,升级ruby会涉及其他软件包,gem等,皆升级到最新。

此时Ruby升级为3.0.0,再次安装pod,问题解决

详细步骤不再重复造轮子,引用下面这位作者文章,对我帮助很大,感谢:https://www.jianshu.com/p/a768181c1245

集成gitlab CI后,脚本执行pod install后出现两个问题:1.让注册当前Mac mini设备ID到profile文件。这是无需的,我们需要在 xcodebuild archive 时 添加 -destination 'generic/platform=iOS' 即可解决;2. 再次pod install时发现 Pods.xcodeproj 不能正常生成,报 can not open Pods.xcodeproj 错误,解决:在 ~/.profile 文件增加: export LANG=en_US.UTF-8

fatal: unable to access ' https://github.com/XXXXXX' : LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

解决方式1

git config --global http.postBuffer 4194304000`

解决方式2

更换Ruby镜源

2.查看Ruby环境:

ruby -v

安装Ruby环境:

brew install ruby

设置git超时时长

git config --global http.lowSpeedLimit 1000(建议0)

git config --global http.lowSpeedTime 600(建议999999)

以上配置后,只有一分钟(600秒)传输速率都低于 1KB/s 的话才会 timeout,即使慢也可以慢慢等。

SDK "iphoneos" can not be located

具体内容:

xcrun:_ error: SDK "iphoneos" cannot be located

xcrun: error: SDK "iphoneos" cannot be located

xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'

解决办法

sudo xcode-select --switch /Applications/Xcode.app

curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

解决办法:

LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

解决办法:

git config 可能是使用了代理

git config --global http.sslBackend "openssl"

如果还有问题应该就是 /usr/local 目录权限相关了。

大概:

cd /usr/local

git reset --hard FETCH_HEAD

git clean -df

brew update

如果 brew update 提示 git pull 失败提示 「failed while git pull」之类,试试用 git checkout Library 替换新文件:

cd /usr/local/git

git checkout Library

然后再 brew update,如果 terminal 里的提示信息是「Operation not permitted」,用 shown 指定一下 /usr/local 的目录和组:

sudo shown -R rainy /usr/local //rainy 换成你的用户名