CocoaPods in Flutter is the native dependency manager for iOS and macOS. It is responsible for downloading and linking iOS frameworks required by Flutter plugins such as Firebase, camera, or maps.
Whenever a Flutter plugin contains native iOS code, CocoaPods is used to integrate it into the app. In practice, CocoaPods has been a required part of Flutter iOS development for years, even though Flutter usually runs it automatically.
If CocoaPods is misconfigured:
flutter doctor reports errorsMost Flutter iOS setup issues come from CocoaPods, not Flutter itself. Understanding this layer saves a lot of debugging time.
When you run flutter pub get or build an iOS app, Flutter generates native files inside the ios/ directory.
CocoaPods reads the Podfile, resolves native dependencies, and installs them into an Xcode workspace (Runner.xcworkspace). Flutter triggers CocoaPods behind the scenes, but CocoaPods must be correctly installed and configured on macOS.
Starting with Xcode 26, CocoaPods is officially deprecated by Apple in favor of Swift Package Manager (SPM).
This means:
At the time of writing, most Flutter plugins still rely on CocoaPods, so CocoaPods remains necessary for many projects. However, developers should expect SPM to become the default dependency system for Flutter iOS apps in the coming years.
Do not use the system Ruby shipped with macOS. It is outdated and protected by the system, which leads to permission errors and broken setups.
rbenv / chruby).brew install ruby
gem install cocoapodsAvoid using sudo gem install cocoapods whenever possible.
CocoaPods in Flutter:
Podfile.lock.Typical issues include:
Runner.xcodeproj instead of Runner.xcworkspace.PATH.Podfile.lock in version control.When iOS builds fail with unclear dependency errors, use this sequence:
cd ios
rm -rf Pods
rm Podfile.lock
pod install
cd ..This resolves most CocoaPods-related issues caused by inconsistent native dependencies.
On newer Macs, rare projects may still require Rosetta for older native libraries.
In such cases, running pod install under x86_64 can help, though this is increasingly uncommon in modern Flutter projects.
To keep CocoaPods stable:
Podfile.lock to Git.Podfile unless necessary.You use CocoaPods whenever:
15 min. • Nov 29, 2022
Flutter has taken the mobile market by storm, but not everybody knows that you don’t always have to write a Flutter app from scratch. It can be integrated into your existing application piecemeal. Read more about the Flutter add to app feature.
16 min. • Jul 17, 2023
Building an enterprise-scale application in Flutter, as in any other framework, requires a specific approach toward organizing the team and the code they create. This comprehensive tech article explains how to approach such a large-scale project.