I have just gotten the new device around 2 weeks ago.
As a mobile developer, I try to compile my Xcode project after installing Cocoapods with
sudo gem install cocoapods to the device.
To my surprise,
pod install does not work as expected this time.
I ended up seeing something as such
LoadError — dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle — /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’ /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require’ /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in
I have found 3 solutions through the internet so far.
1. Open your Terminal under Rosetta and run
sudo gem install ffi in terminal.
2. Run these lines
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install.
3. Install Cocoapods with Homebrew.
I tested out for option 2 as I’m not too familiar with Rosetta at first.
I eventually decided to give option 3 a try ,which is to install Cocoapods from Homebrew.
As more and more developer tools start to support M1 natively, I would go for a native option, unless there isn’t any better option.
As it turns out, Apple Silicon (Big Sur) is supported with stable version!
In my opinion, option 3 is the cleanest solution thus far!
It works perfectly fine.