This problem occurred when POD Install was running today
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: The Mach - o, but wrong architecture/opt/homebrew/lib/ruby/gems / 3.0.0 / gems/ffi - 1.15.0 / lib/ffi_c bundle: The Mach - o, but wrong architecture - / opt/homebrew/lib/ruby/gems / 3.0.0 / gems/ffi - 1.15.0 / lib/ffi_c bundleCopy the code
The solution
1. Uninstall Ruby
brew uninstall ruby --force
Copy the code
2. Uninstall all related items from cocoapods and pass
gem list --local | grep cocoapods
Copy the code
List all relevant items and pass
sudo gem uninstall xxxxxxxxx
Copy the code
Unload all
3. Install the ffi
sudo arch -x86_64 gem install ffi
Copy the code
4. Install cocoapods
sudo arch -x86_64 gem install cocoapods
Copy the code
Then your Cocoapods will run happily on M1