Why am I seeing "Bad CPU type in executable" errors when running CircleCI Builds on Apple Silicon?

Overview

Apple's M1 chip relies on ARM64 architecture, a deviation from the x86-64 architecture used in Intel chips. Certain built binaries meant for Intel chips may not function on the ARM-based M1 chips, causing errors like the following during CircleCI builds.

Bad CPU type in executable

The "Bad CPU type in executable" error occurs when x86-64 binary is used in an environment intended for ARM64, such as an M1 Mac. Applications built to run on Intel's x86-64 architecture may not work smoothly on ARM-based M1 chips, resulting in these errors.

 

Solutions

1. Use an ARM Binary

Some utilities offer both Arm and x86 versions of their binaries. Ensure you install the ARM version if you're using an M1 resource class with CircleCI and do not want to use Rosetta translation.

 

2. Install Rosetta

  • Users can install Rosetta using the macOS Orb's install-rosetta command at runtime during your builds
mac_job:
macos:
xcode: 15.4.0
resource_class: macos.m1.medium.gen1
steps:
- macos/install-rosetta
...

 

  • Alternatively, this can be installed without the orb using the following snippet in a job:
    - run:
name: Install Rosetta translation environment on Apple Silicon Mac
command: softwareupdate --install-rosetta --agree-to-license

Additional Resources

 

Was this article helpful?
2 out of 2 found this helpful

Comments

0 comments

Article is closed for comments.