[Solved] Install Cocoapod on M1 Mac - "sudo gem install ffi" FAIL

Post date: 2021.11.07

For who fail to install Cocoapod on M1 Mac may try this method:

At first I follow tutorial to use rosetta to launch Terminal and “sudo gem install ffi” but fail to install ffi

Finally I use the non rosetta Terminal to install the most updated version (which I write this post at 2021.11.07) of Homebrew which fit M1 chip natively, this version of Homebrew does not need to fix any path issue. You may find how to install on Homebrew’s website.

Then
“brew install libffi”

“brew install cocoapods”

Then it is done.

Cocoapod and Firebase work. Can build and can write data to Firestore.
I am not sure if “brew install libffi” is an essential step but I installed it before Cocoapod

4 Likes

Awesome!

I installed homebrew Der fehlende Paketmanager für macOS — Homebrew (and followed the instructions in the terminal)
I installed ruby (some guidance here: Install Ruby on Your Mac: Everything You Need to Get Going – Stackify ), also followed the instructions in the terminal
I installed libffi
and I installed cocoapods

After closing the terminal and re-opening the terminal, I was able to not only to “pod init” but also to “pod install” ← which never worked for me on my M1 Mac before with the Rosetta Terminal instructions from CwC.

Now it’s finally working. Thank you so much!

1 Like