macOS runner: "bad CPU type in executable" (arm64 vs x86_64) in CI
The kernel refused to run a binary whose architecture does not match the runner CPU. On Apple silicon macOS runners, an x86_64-only executable needs Rosetta 2; an arm64 binary fails on an Intel image.
What this error means
Launching a downloaded tool fails with "bad CPU type in executable" or "zsh: bad CPU type in executable: <tool>", and the process never starts.
arch: posix_spawnp: some-tool: Bad CPU type in executable
zsh: bad CPU type in executable: some-toolCommon causes
An x86_64 binary on Apple silicon without Rosetta
macos-latest is now Apple silicon. An Intel-only binary cannot run unless Rosetta 2 is installed to translate it.
A binary built for the wrong architecture
A toolchain or release fetched for arm64 fails on an Intel runner and vice versa, because the Mach-O has no matching slice.
How to fix it
Install Rosetta 2 for x86_64 binaries
- Install Rosetta 2 on the Apple silicon runner.
- Run the Intel binary, optionally forcing the x86_64 arch.
- Prefer a universal or arm64 build when available.
softwareupdate --install-rosetta --agree-to-license
arch -x86_64 some-tool --versionFetch the matching architecture build
Download the arm64 (or universal) release that matches the runner CPU so no translation is needed.
uname -m # arm64 on Apple silicon; pick the matching assetHow to prevent it
- Detect the runner arch with
uname -mand fetch matching binaries. - Install Rosetta 2 when Intel-only tools are unavoidable.
- Prefer universal builds for cross-architecture CI.