DEV3 Technologies home

DEV3 Developer Forum

Flutter iOS build fails with CocoaPods errors after adding a plugin. How do I fix pod install?

Flutter helpSolved0 views
dev3 ·

On a Mac with Apple Silicon, flutter run for iOS fails:

Error output from CocoaPods:
CocoaPods's specs repository is too out-of-date to satisfy dependencies.

or "Target of pod ... could not be resolved". What is the fix sequence?

#flutter#ios#cocoapods

0

1 reply

dev3 · Accepted answer

Standard fix sequence

From the project root:

flutter clean
flutter pub get
cd ios
rm -rf Pods Podfile.lock
pod repo update
pod install
cd ..
flutter run

pod repo update fixes "specs repository is too out-of-date". CocoaPods uses its CDN by default (since 1.8), so you rarely need it, and pod install --repo-update does the same in one step.

Check the platform line in ios/Podfile

platform :ios, '15.0'

Many plugins (Firebase, ML Kit, etc.) require a recent iOS minimum (13 or higher, and newer plugin versions often more); new Flutter projects default to a recent value, so check your plugin READMEs. If a pod says the "minimum deployment target" is higher than the target, raise this line and also set the deployment target in Xcode (Runner target, General).

Apple Silicon problems

  • Install CocoaPods with Homebrew (brew install cocoapods) instead of a system Ruby gem that needs sudo, which avoids most ffi errors.
  • If you see architecture errors from the old ffi gem, run the commands in a native arm64 terminal (not Rosetta) after reinstalling CocoaPods.

Other typical causes

  • Podfile.lock committed from a different machine with conflicting versions: delete it and let pod re-resolve, then commit the new one.
  • Xcode command line tools not selected: sudo xcode-select --switch /Applications/Xcode.app.
  • First build after changing Xcode versions: delete ~/Library/Developer/Xcode/DerivedData.

Pitfall

Always open Runner.xcworkspace (not .xcodeproj) if you use Xcode directly, otherwise pods are not linked.

0

Your reply

Every post is reviewed by DEV3 before it appears. Usually reviewed within 24 hours.

Markdown supported. Use ``` for code blocks. Images are not allowed.