How to solve error running pod install in flutter on mac?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
The "error running pod install" in Flutter on macOS occurs when CocoaPods fails to install iOS dependencies for your Flutter project. Common causes include outdated CocoaPods, corrupted pod cache, incompatible Ruby versions, and missing Xcode command-line tools. The fix usually involves clearing the pod cache, updating CocoaPods, and ensuring your development environment is properly configured. This error blocks iOS builds but does not affect Android builds.
Fix 1: Clean and Reinstall Pods
This is the most common fix. Removing Pods/ and Podfile.lock forces CocoaPods to resolve and download all dependencies from scratch.
Fix 2: Update CocoaPods
Older versions of CocoaPods may not support newer pod specs. Updating CocoaPods resolves compatibility issues with recently published plugins.
Fix 3: Install Xcode Command-Line Tools
CocoaPods requires Xcode command-line tools for compiling native dependencies. If they are missing or pointing to the wrong Xcode installation, pod install fails.
Fix 4: Fix Ruby Issues
macOS Sonoma and later may not include Ruby by default. Install Ruby via Homebrew and then reinstall CocoaPods with the Homebrew Ruby.
Fix 5: Use pod deintegrate and Reinstall
pod deintegrate removes all CocoaPods integration from the Xcode project, giving you a clean slate. pod cache clean --all removes cached pod downloads that may be corrupted.
Fix 6: Apple Silicon (M1/M2/M3) Specific Fix
On Apple Silicon Macs, some older native gems are not compiled for arm64. Running under Rosetta (arch -x86_64) or installing the ffi gem for x86_64 resolves these architecture mismatches.
Fix 7: Flutter Doctor
flutter doctor -v diagnoses the entire development environment. Fix all issues it reports before attempting pod install again.
Fix 8: Podfile Platform Version
Some Flutter plugins require a minimum iOS version higher than the project default. Update the platform line in Podfile to match the highest required version.
Fix 9: CDN Source Issues
If CocoaPods fails to fetch specs from the CDN, switching to the git-based spec repo or running pod repo update resolves the issue.
Common Pitfalls
- Running pod install from the wrong directory:
pod installmust be run from theios/directory, not the Flutter project root. Running it from the root causes "No Podfile found" errors. - Not running flutter pub get first: Flutter generates the
ios/Podfilebased on yourpubspec.yamldependencies. If you skipflutter pub get, the Podfile may be outdated or missing plugin entries. - Ignoring flutter clean: Stale build artifacts can cause pod install to fail with cryptic errors. Always run
flutter cleanbefore retrying pod install after making changes to dependencies. - CocoaPods version too old for Xcode version: Newer Xcode versions require recent CocoaPods releases. If you see "CDN: trunk" errors or xcframework issues, update CocoaPods to the latest version.
- Modifying Podfile.lock manually: Never edit
Podfile.lockby hand. If it becomes corrupted, delete it and runpod installto regenerate it.
Summary
- Start with
flutter clean, thenrm -rf ios/Pods ios/Podfile.lock, thenflutter pub get, thencd ios && pod install - Update CocoaPods with
sudo gem install cocoapodsif the version is outdated - Install Xcode command-line tools with
xcode-select --install - On Apple Silicon, use
arch -x86_64 pod installif native pod install fails - Run
flutter doctor -vto check for environment issues - Set the correct
platform :iosversion inPodfileto match plugin requirements
Related reading
- How to specify a cluster name for a kubernetes cluster
- How to specify a prefix to a service exposed with an ingress
- How to specify master and worker nodes when using one machine to run Kubernetes?
- How to specify Proxy Pass in kubernetes
- How to solve String interpolation produces a debug description for an optional value; did you mean to make this explicit? in Xcode 8.3 beta?
- How to specify the JDK version in Android Studio?
- How to solve InaccessibleObjectException Unable to make member accessible module A does not 'opens package' to B on Java 9?
- How to solve nan loss?

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.