apple m1 安装cocoapods遇见的问题

1,565 阅读1分钟

今天运行了一下pod install出现了这个问题

LoadError - dlopen(/opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
    /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle

解决方案

1.卸载掉ruby

brew uninstall ruby --force

2.卸载掉cocoapods所有相关项,通过

gem list --local | grep cocoapods

列出所有相关项然后通过

sudo gem uninstall xxxxxxxxx

卸载掉所有

3.安装ffi

sudo arch -x86_64 gem install ffi

4.安装cocoapods

sudo arch -x86_64 gem install cocoapods

这样你的cocoapods就可以在M1上愉快地运行了