Status: Current
Validated against: mobile/build_native.sh, mobile/build_ios.sh, and mobile/build_macos.sh on 2026-03-19.
This directory contains build scripts that ensure CocoaPods dependencies are properly synced before building, preventing the common "sandbox is not in sync with Podfile.lock" errors.
The iOS and macOS Xcode projects have been modified to automatically run pod install when needed during builds. The default CocoaPods check scripts have been replaced with enhanced versions that:
- Check if pods need to be installed
- Automatically run
pod installif needed - Continue with the build process
No manual configuration needed! Just build in Xcode and it will handle CocoaPods automatically.
build_native.sh- Universal build script for both iOS and macOSbuild_ios.sh- iOS-specific build scriptbuild_macos.sh- macOS-specific build script
ios/Scripts/check_pods.sh- Auto-installed iOS CocoaPods check (runs automatically)macos/Scripts/check_pods.sh- Auto-installed macOS CocoaPods check (runs automatically)pre_build_ios.sh- Optional pre-build script for custom Xcode iOS buildspre_build_macos.sh- Optional pre-build script for custom Xcode macOS builds
# Interactive build (asks for platform)
./build_native.sh
# Build iOS debug
./build_native.sh ios debug
# Build iOS release
./build_native.sh ios release
# Build macOS debug
./build_native.sh macos debug
# Build macOS release
./build_native.sh macos release
# Build both platforms
./build_native.sh both debugOr use platform-specific scripts:
# iOS builds
./build_ios.sh debug
./build_ios.sh release
# macOS builds
./build_macos.sh debug
./build_macos.sh releaseThe Xcode projects have been pre-configured to automatically handle CocoaPods!
When you build in Xcode, the projects now:
- Automatically check if
pod installis needed - Run
pod installif dependencies are out of sync - Continue with the normal build process
No manual setup required - just open the .xcworkspace file and build!
If you need additional pre-build steps, you can still add the pre-build scripts:
- Open
ios/Runner.xcworkspaceormacos/Runner.xcworkspacein Xcode - Select the "Runner" scheme
- Click "Edit Scheme..."
- Go to "Build" → "Pre-actions"
- Click "+" and select "New Run Script Action"
- Set "Provide build settings from" to "Runner"
- Add the appropriate script path
- Run
flutter pub getto ensure Flutter dependencies are current - Check CocoaPods status in the respective platform directory
- Run
pod installif needed to sync dependencies - Build the Flutter app for the specified platform and configuration
If you still get CocoaPods errors:
-
Clean build folders:
flutter clean rm -rf ios/Pods ios/Podfile.lock rm -rf macos/Pods macos/Podfile.lock
-
Update CocoaPods:
sudo gem update cocoapods
-
Update pod repo:
pod repo update
-
Then run the build scripts again
- These scripts automatically handle the timing of
pod installrelative to Flutter builds - They check if CocoaPods installation is actually needed before running it
- Safe to run multiple times - they won't reinstall pods unnecessarily
- Pre-build scripts can be added to Xcode schemes to fix builds from within Xcode