
Solved: Flutter 'CocoaPods not installed or not in valid state' on Mac Silicon
You have just set up your sleek new MacBook Pro (M1, M2, or M3), cloned your Flutter repo, and ran flutter run. Instead of your app launching on the simulator, the terminal screams red:
"CocoaPods not installed or not in valid state."
Or perhaps: "Error: CocoaPods's specs repository is too old to satisfy dependencies."
As a Flutter developer who migrated to Apple Silicon early, I battled this issue more times than I care to admit. The transition from Intel (x86) to ARM64 architecture broke a lot of Ruby gems, and CocoaPods—the dependency manager for iOS—sits right in the middle of that chaos.
Don't worry. You don't need to reinstall macOS. Here is the proven workflow to fix CocoaPods and get your Flutter iOS build running on Apple Silicon.
Root Cause Analysis
Why does this keep happening?
- Ruby Architecture Mismatch: macOS comes with a system Ruby. Creating a gem environment that mixes ARM and x86_64 binaries often leads to
ffi(Foreign Function Interface) errors. - Gem Permission Issues: Trying to install cocoapods using the system Ruby without
sudo(which you shouldn't do anyway) causes permission denials. - Outdated Repo: The CocoaPods master repo on your machine is out of sync with the actual specs online.
The Solution: Step-by-Step
Here is the "Golden Path" that works for 99% of Apple Silicon setups.
1. Install Homebrew (The Right Way)
Ensure you have the ARM64 version of Homebrew installed. Run:
which brew
It should return /opt/homebrew/bin/brew. If it returns /usr/local/bin/brew, you are running under Rosetta, which can complicate things. For M-series chips, aim for /opt/homebrew.
2. Use a Ruby Manager (rbenv)
Stop using the system Ruby. This is the #1 mistake. The system Ruby is old and protected by macOS SIP (System Integrity Protection).
Install rbenv to manage a separate Ruby version:
brew install rbenv ruby-build
Initialize it:
rbenv init
(Follow the on-screen instructions to add the eval command to your .zshrc).
Install a fresh, modern Ruby version:
rbenv install 3.2.2
rbenv global 3.2.2
3. Install CocoaPods and the FFI Fix
Now that you are on your own clean Ruby version, install CocoaPods. The magic trick for Apple Silicon is dealing with the ffi gem properly.
run:
gem install cocoapods
Crucial Step: If you see errors related to ffi during installation, force the architecture (though on modern Ruby versions this is less common, it still fixes stubborn setups):
sudo arch -x86_64 gem install ffi
sudo arch -x86_64 gem install cocoapods
Note: I prefer avoiding sudo and arch flags if rbenv is set up correctly, but sometimes aggressive caching requires it.
4. Clean Your Flutter Project
Now, go to your project folder. We need to nuke the existing generic attempts Flutter made.
cd ios
rm -rf Pods
rm Podfile.lock
cd ..
flutter clean
flutter pub get
5. The Rosetta Terminal Trick (If All Else Fails)
If you are still stuck, your terminal app itself might need to run in Rosetta mode (emulation), although this is becoming less necessary in 2026.
- Go to Finder > Applications > Utilities.
- Right-click Terminal.
- Select Get Info.
- Check Open using Rosetta.
- Restart Terminal and run
cd ios && pod install.
Expert Tip: The pod repo update Myth
[!TIP] Don't just run
pod repo updateblindly. You will see StackOverflow answers telling you to runpod repo update. On modern CocoaPods (1.10+), this uses the CDN and a full repo update is painfully slow (it downloads gigabytes). Instead, try:cd ios && pod install --repo-update. This updates only what is needed for your specific dependencies.
Alternative Fix: Homebrew CocoaPods
If the Ruby gem route is just too broken on your machine, you can install CocoaPods directly via Homebrew:
brew install cocoapods
This bundles its own Ruby environment. However, you must uninstall the gem version first (gem uninstall cocoapods) to avoid path conflicts. I recommend the Gem approach (steps 1-4) as it offers more control, but Homebrew is a solid fallback.
Conclusion
Getting Flutter to build on iOS can feel like untangling headphones, but proper environment setup is key. By using rbenv and avoiding the system Ruby, you future-proof your setup against the next macOS update.
Successfully built? Run flutter run and enjoy that high-performance emulation!