fix(flutter): fetch the arm64 macOS archive on Apple Silicon hosts - #9
Merged
Merged
Conversation
The macOS SDK repository always downloaded the x64 release archive (flutter_macos_<version>-stable.zip). Its Dart binaries are x86_64, so on an Apple Silicon host without Rosetta 2 every fetch-time warm-up fails with 'Bad CPU type in executable' and the toolchain is unusable. Select the archive variant by host architecture: on aarch64/arm64 macOS the repository fetches flutter_macos_arm64_<version>-stable.zip (the directory component stays 'macos'; only the file name carries the variant). Integrity is resolved against the variant actually fetched: the generated version table now records a 'macos_arm64' SRI for every version that publishes one, the flutter.toolchain integrity escape hatch accepts a 'macos_arm64' key, and flutter_repositories grew a matching integrity_arm64 attribute. update_flutter_versions.sh extracts both macOS hashes from the release metadata; regenerating the table also picked up the stable releases published since the last refresh (3.44.6 through 3.47.1). Verified on an arm64 Mac without Rosetta 2: examples/hello_world builds and its widget test passes against the working tree, with the fetched dart-sdk binaries confirmed Mach-O arm64; //... passes (14 tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
SpencerC
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The macOS SDK repository always downloads the x64 release archive
(
flutter_macos_<version>-stable.zip). Its Dart binaries are x86_64, so on anApple Silicon host without Rosetta 2 every fetch fails during the warm-up steps
with:
making the toolchain unusable on such machines (Rosetta 2 is not installed by
default, and installing it requires admin rights).
Fix
Select the archive variant by host architecture in
_flutter_repo_impl: onaarch64/arm64macOS the repository fetchesflutter_macos_arm64_<version>-stable.zip. The URL's directory component staysmacos; only the file name carries the variant, matching how Flutter publishesits releases.
Integrity is resolved against the variant actually fetched:
scripts/update_flutter_versions.shnow extracts both macOS hashes from therelease metadata, and the regenerated
versions.bzlrecords amacos_arm64SRI for every version that publishes one. (The refresh alsopicked up the stable releases published since the last run, 3.44.6–3.47.1.)
flutter.toolchain(integrity = {...})escape hatch accepts a"macos_arm64"key, carried into the repository rule by a newintegrity_arm64attribute — backward compatible with existing callers.Docs (
docs/extensions.mdvia//docs:update) and CHANGELOG updated; thelockfile changes are the resolved extension's new attribute and bzl digest.
Verification
On an arm64 Mac without Rosetta 2 (the previously broken scenario):
bazel test //...— 14/14 passexamples/hello_world:bazel test --override_module=rules_flutter=<tree> //...builds and the widget test passes; the fetched
dart-sdkbinaries areMach-O 64-bit executable arm64macos_arm64SRI matches a hash computed independentlyfrom a separately downloaded copy of the archive
🤖 Generated with Claude Code