How To Correctly Install CocoaPods On Apple Silicon M1, M2 & M3?

The painless method, before you start pulling your hair…

Attila Vágó
Bricks n’ Brackets

--

Photo by Yogendra Singh on Unsplash

An uncharacteristically super short article for sure, but as I was installing and testing various development workflows on the new M2 MacBook Air, I remembered something from back when I did the same on the M1 and the M1 Pro/Max, but never shared with the rest of the world. I wrote my first-ever article on Medium as documentation for myself really, that I then decided to share with the rest of the dev community, so true to that original mission, here’s another one.

If you’re at all interested in Flutter development, this is something you’ll quickly run into once you spin up an iOS emulator ready to run your most amazing app. As the app attempts to build, you’ll get an error thrown regarding your CocoaPods, and it will likely have to do something with ffi, which is funny because you remember installing them! 😱 Fear not though, there is a simple fix for all of this cocoa nonsense, and yes, it stems from you—lucky bastard—using an M1 or M2 machine!

There are three components to making this all work, and each one is just a couple of commands away from success.

  1. Make sure you have Rosetta installed. This is going to eventually not be a requirement, but I’d give it another couple of years before that’s realistically the case. softwareupdate --install-rosetta
  2. Install homebrew. While there are ways around this, I think that it’s in every developer’s interest to have the brew magic in their toolkit. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Finally, get your Cocoapods! Just in case you did a mess before, uninstall whatever you did previously by running sudo gem uninstall cocoapods and then brew install cocoapods.

And there you have it, running your lovely Flutter app should now build without any Cocoapod errors. Note, this is not only an Apple Silicon M1 solution, this works great for M2 and I suspect — an educated guess — for all future M generation SOCs.

Hi there! 👋

Recently, I started a new publication — Bricks n’ Brackets — dedicated to LEGO, tech and coding. It would mean a huge deal to me if you’d follow it, though only do so, if any of those topics pique your interest. You can also read more about why I started it and what my overall goal with it is. You can also join as a writer if you’d like, as long as you submit articles around those three topics. The publication also has a YouTube, Instagram and TikTok channel. Thank you, and may the gods of creativity and success guide your day!

Attila Vago — Software Engineer improving the world one line of code at a time. Cool nerd since forever, writer of codes and blogs. Web accessibility advocate, LEGO fan, vinyl record collector. Loves craft beer!

--

--

Attila Vágó
Bricks n’ Brackets

Staff software engineer, tech writer, author and opinionated human. LEGO and Apple fan. Accessibility advocate. Life enthusiast. Living in Dublin, Ireland. ☘️