通常使用M1芯片在运行pod install时都会遇到这种报错;在报错中已经把三种可能性的解决方案网址放出来了。
- missing compatible arch in …
https://github.com/CocoaPods/CocoaPods/issues/10541
(指令集兼容问题,没遇到过)- I got error when doing pod install, something to do with M1 chip
https://github.com/CocoaPods/CocoaPods/issues/10569- CocoaPods compatibility with Apple DTK (Apple Silicon)
https://github.com/CocoaPods/CocoaPods/issues/9907
(现在基本上没有用DTK了的吧)
绝大多数问题都是第二个。
解决方案
1
在终端运行:
sudo arch -x86_64 gem install ffi
然后在每次使用pod install时都替换成
arch -x86_64 pod install
2
在要运行pod install之前将终端的运行方式设置为Rosetta2:
然后运行pod install:
用完了再调回来。(当然一直用Rosetta跑的就不会有这个问题了)
这个方法略微麻烦。
—————————————————————
以上两种方法都不适用于Carthage