Skip to content

Print a warning when building a macOS app that supports both Intel and ARM and guide to enable feature flag #188333

Description

@vashworth

Xcode 27 now accepts arm-only macOS binaries in the AppStore.

Flutter should introduce a feature flag flutter config --enable-macos-arm64-only. This flag will start as defaulting to false.

See example feature flags:
https://github.com/flutter/flutter/blob/e228771afe936c4aa460faf991b520be18c88bdd/packages/flutter_tools/lib/src/features.dart

When enable-macos-arm64-only is enabled, the target build destination should specify the architecture to arm64:

final String destination;
if (buildInfo.isDebug) {
// Debug builds default to current host architecture
destination = 'platform=${XcodeSdk.MacOSX.displayName},arch=$arch';
} else {
// Release builds default to universal binary
destination = XcodeSdk.MacOSX.genericPlatform;
}

When the following criteria are met, we should print a warning that a future version of Flutter will default to arm-only and they can opt in by enabling the feature flag.

Criteria for warning:

  • When using Xcode 27
  • When targeting generic platform
  • When x86_64 isn't already in EXCLUDED_ARCHS
  • enable-macos-arm64-only is disabled
  • Targeting release mode

final String destination;
if (buildInfo.isDebug) {
// Debug builds default to current host architecture
destination = 'platform=${XcodeSdk.MacOSX.displayName},arch=$arch';
} else {
// Release builds default to universal binary
destination = XcodeSdk.MacOSX.genericPlatform;
}
// Get EXCLUDED_ARCHS from Xcode project build settings
// This allows developers to exclude specific architectures (e.g., x86_64)
// when dependencies don't support them
final String? excludedArches = buildSettings['EXCLUDED_ARCHS'];

Draft warning:

Xcode 27 no longer requires macOS binaries to support the x86_64 architecture. To build ARM-only macOS apps now, run: "flutter config --enable-macos-arm64-only". This will become the default behavior in a future Flutter release.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listplatform-macosBuilding on or for macOS specificallyteam-macosOwned by the macOS platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-macosTriaged by the macOS platform team

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions