Skip to content

fix(install): use prebuilt wasm-bindgen binary on macOS aarch64#1585

Merged
guybedford merged 1 commit into
wasm-bindgen:masterfrom
guybedford:fix/wasm-bindgen-macos-aarch64-prebuilt
May 22, 2026
Merged

fix(install): use prebuilt wasm-bindgen binary on macOS aarch64#1585
guybedford merged 1 commit into
wasm-bindgen:masterfrom
guybedford:fix/wasm-bindgen-macos-aarch64-prebuilt

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

This makes wasm-pack download the prebuilt wasm-bindgen-cli release on macOS aarch64 instead of falling back to building from source, resolves #1581.

On Apple Silicon the existing match arm only covered cargo-generate and wasm-opt, so wasm-bindgen fell through to _ => bail!(\"Unrecognized target!\") and wasm-pack ended up invoking cargo install. wasm-bindgen has published aarch64-apple-darwin tarballs since 0.2.100, so we can just point at those.

The change collapses the two MacOS aarch64 arms into a wasm-opt-specific one plus a catch-all that returns aarch64-apple-darwin for every other tool:

(Os::MacOS, Arch::AArch64, Tool::CargoGenerate) => \"aarch64-apple-darwin\",
(Os::MacOS, Arch::AArch64, Tool::WasmOpt) => \"arm64-macos\",

becomes:

(Os::MacOS, Arch::AArch64, Tool::WasmOpt) => \"arm64-macos\",
(Os::MacOS, Arch::AArch64, _) => \"aarch64-apple-darwin\",

The existing can_download_prebuilt_wasm_bindgen test is now also enabled on macos/aarch64 so the new code path is actually exercised, alongside all_latest_tool_download_urls_valid which already iterates every (tool, arch, os) combination and HEAD-checks the URL.

Verified locally on Apple Silicon - all three download tests pass, including the new aarch64 wasm-bindgen download.

Previously wasm-pack built wasm-bindgen-cli from source on Apple Silicon
because the macOS aarch64 match arm only covered cargo-generate and
wasm-opt. wasm-bindgen publishes an aarch64-apple-darwin tarball for
every release, so fall through to that target for any tool other than
wasm-opt (which uses the binaryen 'arm64-macos' naming).

Also enable the can_download_prebuilt_wasm_bindgen test on
macos/aarch64 so the new code path is exercised in CI.

Fixes wasm-bindgen#1581
@guybedford guybedford force-pushed the fix/wasm-bindgen-macos-aarch64-prebuilt branch from 1d199ec to 9f68c69 Compare May 20, 2026 18:03
@guybedford guybedford merged commit 3d157e3 into wasm-bindgen:master May 22, 2026
4 checks passed
@guybedford guybedford deleted the fix/wasm-bindgen-macos-aarch64-prebuilt branch May 22, 2026 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use wasm-bindgen-cli binary release on macos aarch64

1 participant