Skip to content
CoreMacs
CI/CDGuide

Flutter and React Native iOS builds on a Mac: the failures you will actually meet

Flutter and React Native iOS builds can break where Xcode, Node, Ruby, CocoaPods and the framework SDK meet. This guide covers Mac tooling, SwiftPM and the CocoaPods trunk change, CI signing, and version pinning.

CoreMacs News Desk·Published ·Last verified ·5 min read
A silver Mac mini on a wooden developer desk with a display, keyboard, black mouse, warm lamp and plant.

A cross-platform app looks like one project, but its iOS build touches several toolchains at once: Xcode and its command line tools, the framework (Flutter or React Native), a JavaScript or Dart package manager, and a native dependency manager. A build can fail because these layers disagree, even when the app code is fine.

What the Mac needs before the first build

Both frameworks' official guides say iOS builds need a Mac. The React Native environment guide asks for the latest Xcode, the Command Line Tools selected under Locations in Xcode settings, an installed iOS simulator and Node 22.11.0 or newer at the time of writing, and strongly recommends Watchman. It describes CocoaPods as a Ruby gem and points to the CocoaPods getting-started guide.

Flutter's iOS setup page gives the equivalent Xcode steps: select the command line tools, accept the license and download platform support. It also asks for the latest CocoaPods so that plugins with native iOS code are supported.

sudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch'
sudo xcodebuild -license
xcodebuild -downloadPlatform iOS

If Xcode is installed elsewhere or you need another version, the page says to replace /Applications/Xcode.app with that installation's path. In general, on a CI image with several Xcode versions, set the path explicitly rather than relying on the image default. Running flutter doctor afterwards is a reasonable general check, though the setup page does not cover it.

Dependency problems: Pods, SwiftPM and trunk

Flutter's documentation says Swift Package Manager support has been on by default since the 3.44 release, falling back to CocoaPods for dependencies without SwiftPM support, so one project can use both. To check the integration, run the app in Xcode and confirm that Run Prepare Flutter Framework Script runs as a pre-action and that FlutterGeneratedPluginSwiftPackage is a target dependency. A project can opt out in pubspec.yaml with enable-swift-package-manager: false under flutter: config:, but the docs advise against it, note that the CocoaPods registry becomes read-only on December 2, 2026, and say disabling SwiftPM will not be allowed in the future.

A SwiftPM plugin that needs a higher minimum iOS version than your target triggers an error naming both versions. Raise the app's Minimum Deployments in Xcode, then regenerate the configuration files:

flutter build ios --config-only

The CocoaPods blog states that trunk will permanently stop accepting new podspecs on December 2, 2026, after a test run of read-only mode scheduled for November 2-6, 2026. The post says the dates could still move, existing builds should keep working, and dependency updates will no longer arrive through trunk. Check the blog for the current schedule.

Apple silicon and Rosetta

The framework pages we opened do not discuss Rosetta, so treat this section as general practice rather than documented behavior. A shell, Ruby or Node running under Rosetta can build gems or native modules for the wrong architecture, which later surfaces as a confusing linker or load error. Log uname -m and file $(which node) in the CI job so a mismatch is visible in the build log.

Signing in CI

Flutter's release guide describes a terminal-based path with the Codemagic CLI tools that can be scripted in CI. Certificates live in a temporary keychain isolated from the login keychain, and an App Store Connect API key with App Manager access comes from environment variables. In outline:

  1. Create a temporary keychain with keychain initialize; the guide says you must then run keychain use-login, which sets the login keychain as the default.
  2. Fetch signing files with app-store-connect fetch-signing-files, then run keychain add-certificates and xcode-project use-profiles, which generates the export options file.
  3. Install dependencies, then build with that file.
  4. After the build and app-store-connect publish, run keychain use-login again.
flutter build ipa --release --export-options-plist=$HOME/export_options.plist

flutter build ipa produces an .xcarchive under build/ios/archive/ and an .ipa under build/ios/ipa/. Each upload needs a unique build number, which you can override with --build-number.

For React Native, the device guide covers signing through the Team setting on the General tab for the main and Tests targets, and says to open the .xcworkspace, not the .xcodeproj, when using CocoaPods. A separate App Store publishing guide builds with the Release scheme and Product > Archive, and mentions the CLI's --mode Release option.

The environment guide also says the template's .xcode.env file exports the path to node in NODE_BINARY, its suggested way to decouple the build from the system's Node. If a build cannot find the Node you expect, check that file first.

Caching without poisoning the build

As general practice rather than documented behavior, teams commonly cache ios/Pods (or Swift package downloads), node_modules and the Flutter pub cache, keying each on its lockfile: Podfile.lock, the JavaScript lockfile and pubspec.lock. The pages cited here do not cover caching. After an Xcode or SDK upgrade, clear the caches before debugging a strange failure, and commit the lockfiles so cache keys mean something.

Pin everything, in files the repository owns

FVM, the Flutter version manager, pins a per-project SDK with fvm use. Its configuration page says the command creates .fvmrc, which holds the project's Flutter version, and recommends adding the .fvm directory to .gitignore; the getting-started page says teams stay on one version through .fvmrc. Committing .fvmrc is the natural way to give CI that version, though neither page says so outright. Node and Ruby version files such as .nvmrc or .ruby-version do the same job if your tooling reads them. As general practice, record the exact Xcode version in your CI configuration and fail the job early if xcodebuild -version differs.

A short pre-flight step that logs tool versions makes mismatches visible before the build starts:

xcodebuild -version
node --version
ruby --version
pod --version
flutter doctor

Sources

Share