DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Stacey
Stacey

Posted on

Installing Cocoapods on M1 Macbook Air, Big Sur

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
Enter fullscreen mode Exit fullscreen mode

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
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.

https://formulae.brew.sh/formula/cocoapods

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)

Collapse
 
emindeniz99 profile image
Emin Deniz

Thank you, third solution is easy :D and native.

Collapse
 
ukumar246 profile image
utkarsh kumar

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!

Collapse
 
majidjamali profile image
Majid Jamali

Thank you very much, i was about to update my ruby!

Find and follow new tags! πŸ€” Did you know? Β  DEV has a variety of tags to help you find the content you like. Find and follow your favorite tags