Skip to content

Commit 52ec107

Browse files
authored
Add article re: "bad CPU type in executable" error (#172)
We saw a spike in reports of this error following the recent release of the native Apple Silicon build of Arduino IDE. Investigation showed that the affected users did not have the Rosetta 2 translation software required to run executables built for x86 (AKA "Intel") host architecture on Apple Silicon machines. Previously, this condition was not likely to occurr because macOS shows a dialog when the user starts an x86 application if Rosetta 2 is not already installed. But it turns out macOS doesn't do that if the x86 executable is run by a subprocess. So users of the Apple Silicon build of Arduino IDE do not get the dialog when starting Arduino IDE, since the application itself does not require Rosetta 2, but when Arduino IDE executes one of the helper tools (e.g., avr-gcc) that is not built for Apple Silicon, the process fails with the "bad CPU in executable" error. The solution is for the user to manually install Rosetta 2. Instructions for that are provided here. The article is intended to be a comprehensive guide to solving the "bad CPU type in executable" error. This error may occur under other conditions than the one described above, so instructions for the resolution of the error as it occurs under those other conditions are also included.
1 parent 02c473e commit 52ec107

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: 'Error "bad CPU type in executable" on macOS'
3+
---
4+
5+
Under certain conditions, startup or other operations of the Arduino development software might fail with a "`bad CPU type in executable`" error.
6+
7+
This problem can be solved by one of the methods described below:
8+
9+
## If your Mac computer has an Apple Silicon processor
10+
11+
Some of the tools used by the Arduino development software are built for use on x86-64 processors, like those in Intel-based Macs. These can still be used on the [Apple Silicon](https://support.apple.com/en-us/HT211814) Mac computers thanks to a program named **Rosetta** that Apple provides.
12+
13+
**Rosetta** is not pre-installed with macOS. If you have not already installed **Rosetta**, the tools built for use on x86-64 processors processors will fail to run with a "`bad CPU type in executable`" error.
14+
15+
The solution is to install **Rosetta** by one of the following methods:
16+
17+
### Installation Dialog
18+
19+
When you start an application that requires it, macOS will show [a dialog offering installation of **Rosetta**](https://support.apple.com/en-us/HT211861). If you are presented with this dialog when starting the Arduino development software, click the ![Install button](img/symbol_install-rosetta.png) button and complete the installation.
20+
21+
### Manual Installation
22+
23+
If the tool requiring it is run by the Arduino development software as a subprocess, macOS does not show a dialog offering installation of **Rosetta**. In this case you must manually install **Rosetta**:
24+
25+
1. Open **Terminal** (instructions [here](https://support.apple.com/en-ca/guide/terminal/apd5265185d-f365-44cb-8b09-71a064a42125/mac#trml663c6997)).
26+
1. Type the following command in the **Terminal** window:
27+
28+
```text
29+
softwareupdate --install-rosetta
30+
```
31+
32+
1. Press the <kbd>**Enter**</kbd> key.
33+
1. Accept the license agreement with Apple.
34+
1. Wait for the installation to finish.
35+
36+
<!-- markdownlint-disable HC001 -->
37+
38+
## If your computer has a different processor or Rosetta is already installed
39+
40+
<!-- markdownlint-enable HC001 -->
41+
42+
Tools used by the Arduino development software may not be compatible with the processor on your computer. In this case, when the Arduino development software attempts to use the tool it will fail with a "`bad CPU type in executable`" error.
43+
44+
This type of incompatibility is usually caused by using a very old version of a tool. This is often the result of having an outdated version of the platform for your board installed. If so, the solution is to update to the latest version using the Arduino IDE **Boards Manager**:
45+
46+
1. Select **Tools > Board > Boards Manager...** from the Arduino IDE menus to open the "**Boards Manager**" view.
47+
1. Scroll down through the list of boards platforms until you see the entry for the platform of the board you are using.
48+
1. Check to see whether there is a newer version listed in the menu at the bottom of the entry. If so, proceed with the rest of the steps in these instructions.
49+
1. Click the "**INSTALL**" button at the bottom of the entry.
50+
1. Wait for the update to finish.
51+
1. Close the "**Boards Manager**" view.
Loading

0 commit comments

Comments
 (0)