Skip to content
Latchkey

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
arch: posix_spawnp: some-tool: Bad CPU type in executable
zsh: bad CPU type in executable: some-tool

Common 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

  1. Install Rosetta 2 on the Apple silicon runner.
  2. Run the Intel binary, optionally forcing the x86_64 arch.
  3. Prefer a universal or arm64 build when available.
Terminal
softwareupdate --install-rosetta --agree-to-license
arch -x86_64 some-tool --version

Fetch the matching architecture build

Download the arm64 (or universal) release that matches the runner CPU so no translation is needed.

Terminal
uname -m   # arm64 on Apple silicon; pick the matching asset

How to prevent it

  • Detect the runner arch with uname -m and fetch matching binaries.
  • Install Rosetta 2 when Intel-only tools are unavoidable.
  • Prefer universal builds for cross-architecture CI.

Frequently asked questions

What causes ""bad CPU type in executable""?
macos-latest is now Apple silicon. An Intel-only binary cannot run unless Rosetta 2 is installed to translate it.
How do I fix "bad CPU type in executable"?
Install Rosetta 2 for x86_64 binaries

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card