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.
Errors
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
Solutions Available:
I have found 3 solutions through the internet so far.
1. Open your Terminal under Rosetta and run sudo gem install ffi
in terminal.
Open Finder > Applications > Utilities > Terminal > Right Click > Get Info > Open Using Rosetta
2. Run these lines
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
.
3. Install Cocoapods with Homebrew.
My Pick
I tested out for option 2 as I’m not too familiar with Rosetta at first.
It works.
I eventually decided to give option 3 a try ,which is to install Cocoapods from Homebrew.
Why?
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!
Finale
In my opinion, option 3 is the cleanest solution thus far!
It works perfectly fine.
Happy exploring!
Top comments (3)
Thank you, third solution is easy :D and native.
Super useful, thanks.. the other posts and articles were more like run this command. This explains the pros and cons and the details behind what happens!
Thank you very much, i was about to update my ruby!