Fix: Missing Pods-Runner.debug.xcconfig in Search Paths in Xcode Flutter Build

Fix: Missing Pods-Runner.debug.xcconfig in Search Paths in Xcode Flutter Build

Written by

in

Quick answer: The error occurs because CocoaPods dependencies haven’t been installed or are corrupted. Run cd ios && pod install in your Flutter project to generate the missing Pods configuration files. If that fails, delete the Podfile and run flutter build ios to regenerate it.

Why this happens

The error could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig' in search paths means Xcode cannot locate the CocoaPods-generated configuration file for the Runner target. This file is created when you run pod install and contains compiler flags, linker settings, and framework search paths required by your Flutter plugins.

Common causes:
– You cloned a Flutter project but never ran pod install in the ios directory
– The Pods folder was deleted or excluded from version control
– A previous pod install failed silently or was interrupted
– You switched Xcode versions or updated macOS, invalidating the existing Pods cache

The Debug.xcconfig file in ios/Flutter/ includes the missing Pods-Runner.debug.xcconfig via an #include directive. When the Pods directory doesn’t exist, the include path resolves to nothing and the build fails.

How to fix it

1. Run pod install in the ios directory (most common fix)

Open Terminal, navigate to your Flutter project root, then enter the ios folder and install pods:

cd /path/to/your/flutter/project
cd ios
pod install

This downloads all dependencies declared in Podfile and generates the Pods/ directory with the required Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig file. After it completes, run flutter run or open Runner.xcworkspace in Xcode and build again.

Note: Always open the .xcworkspace file, not the .xcodeproj, after running pod install. The workspace includes the Pods project.

2. Regenerate the Podfile and reinstall (if step 1 fails)

If pod install reports errors or the Podfile is outdated, remove it and let Flutter recreate a fresh one:

cd /path/to/your/flutter/project
rm ios/Podfile
flutter build ios

flutter build ios regenerates ios/Podfile from your pubspec.yaml plugin dependencies, then runs pod install automatically. This ensures the Podfile matches your current Flutter plugin set.

3. Clean derived data and Pods cache (persistent issues)

If the above steps don’t work, stale Xcode caches may be interfering:

cd /path/to/your/flutter/project/ios
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/Runner-*
pod install

Then clean the Flutter build cache:

flutter clean
flutter pub get
flutter run

How to prevent it

  • Commit ios/Podfile and ios/Podfile.lock to version control; add ios/Pods/ to .gitignore
  • Run pod install after every flutter pub get that adds or removes iOS plugins
  • Use flutter build ios instead of building directly in Xcode for the first build after dependency changes
  • Keep CocoaPods updated: sudo gem install cocoapods periodically

FAQ

Why does Flutter need CocoaPods for iOS builds?

Flutter plugins that include native iOS code (camera, maps, Firebase, etc.) are distributed as CocoaPods dependencies. The Podfile in your ios directory declares these plugins, and pod install fetches them and configures the Xcode project to link them.

Can I fix this without Terminal?

You can open ios/Runner.xcworkspace in Xcode, but Xcode won’t auto-run pod install. The missing file is generated by CocoaPods, not Xcode. You must run pod install from the command line or use a tool like CocoaPods.app.

What if pod install fails with permission errors?

Run sudo gem install cocoapods to ensure CocoaPods is installed system-wide, then try pod install again. On Apple Silicon Macs, you may need arch -x86_64 pod install if a plugin lacks arm64 support, though this is rare in 2024+.

Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.