“bad CPU type in executable” – what to do?

Some macOS users are reportedly getting the "bad CPU type in executable" error when running commands from the Terminal. This issue is most often met in macOS 10.15 "Catalina" and macOS 11 "Big Sur".

![bad CPU type in executable](https://raw.githubusercontent.com/linuxpip/imghost/master/20211621212216095-bad CPU type in executable.png)

As it turns out, this particular issue can occur due to several different common scenarios. Here’s a list of potential culprits that might be triggering this error code:

  • Old, non-compatible programs - Since Catalina, macOS dropped support for 32-bit executables. So if your program did not made it to 64-bit or some of its libraries are still 32-bit, it may not run properly.
  • Rosetta 2 not installed - Apple M1 is an ARM-based chip, different from the Intel processors used in the prior devices. Software needs to be translated from x86 instructions to ARM via Rosetta 2 to be able to run on M1-based devices. Double check that Rosetta 2 is installed on your system.

Update your software

As it turns out, one of the most common instances that might trigger this problem is your software of choice is built for 32-bit system. "bad CPU type in executable", despite being vague, is just a simple message indicates that your software is not compatible.

Most modern software has a built-in update mechanism, but if it does not, try grabbing the latest version of your software from its official website to see whether the error message goes away.

Install Rosetta 2

When macOS tries to run an app that is not built for Apple-made chip (Apple Silicon), macOS will prompt to install Rosetta 2 to automatically translate the app from x86 to ARM instructions.

But if you run commands in the Terminal, there is no automatic detection for missing Rosetta.

In rare cases, users who recover their Mac from a backup won't get Rosetta 2 during the restoration process.

If you haven't been prompted to install Rosetta 2, please manually install it by running the following command.

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Once you got Rosetta installed, you can run the entire terminal app using Rosetta by opening Get Info on Terminal.app in Finder and check the Open using Rosetta box. This way, Terminal and any command or binary it tries to run will go through Rosetta, so you don't have to worry about manually open each of them manually.

Find all 32-bit executables in your Mac

Now that you know the problem is all about the software is not compatible with the processor and overall architecture, you may ask : How do I know which program I need to reinstall/replace?

Most, if not all, programs you can run from Terminal app are placed in a system path. $PATH environment variable contains all of those path. Here’s a quick command you can run in Terminal to list any 32-bit binaries in your $PATH on macOS-based device.

find `echo $PATH | tr ":" "\n"` -perm +1111 -exec file {} \; | grep i386

![Find all 32-bit executables in your Mac](https://raw.githubusercontent.com/linuxpip/imghost/master/20211621223359027-Find all 32-bit executables in your Mac.png)

Replace all of those programs with 64-bit compatible binaries and you should be good to go.

Replace software with native ARM builds

To find programs which are not compatible with the system (64-bit ready), we can go to System Information > Software. Here you have to inspect Applications and Legacy Software section for any 32-bit software as in the screenshot below.

Replace software with native ARM builds

When searching for 64-bit or ARM-native software, look for something with "SiMac" or "Apple Silicon" or "ARM64".

Fix bad CPU type in executable for Android Studio

If you're an Android application developer, you should be looking for solutions to fix your code. In that case, ValueInBrief post is an excellent guide, which may save you hours of debugging time. Quick summary, the solution involved setting renderscriptSupportModeEnabled to false or switch from androidx libraries to the old support libraries. Consult the original post for detailed guide.

Click to rate this post!
[Total: 1 Average: 5]

Leave a Comment