To get the Arduino IDE working on Apple Silicon, you have to provide a replacement compiler and uploader built for Apple Silicon, and then create a local configuration file that tells the Arduino IDE to use those updated versions.
I started by following the instructions here: Apple Silicon functional toolchain
The gist of this is to replace avr-gcc, ctags, and avrdude with apple silicon native versions, then to point the IDE preferences file to use the correct versions.
Step 1: Install avr-gcc
-
Install Xcode Command Line Tools
Before installing avr-gcc, make sure you have Xcode command line tools installed. Open your Terminal and run:xcode-select --install
-
Install avr-gcc via Homebrew
If you haven’t installed Homebrew yet, follow the instructions on brew.sh. Once it's set up, run the following commands to install avr-gcc:brew tap osx-cross/avr brew install avr-gcc
At the time of this writing, avr-gcc version 9.4.0_1 is the latest. You can find the installed files under:
/opt/homebrew/Cellar/avr-gcc@9/9.4.0_1/bin/
-
Copy avr-gcc to Arduino Library
To integrate the new compiler with Arduino, copy the entire version folder into the Arduino package directory:cp -r /opt/homebrew/Cellar/avr-gcc@9/9.4.0_1/ ~/Library/Arduino15/packages/arduino/tools/avr-gcc/
Step 2: Install ctags
-
Clone the ctags Repository
If you don’t have the GitHub CLI installed, you can install it with:brew install gh
Then, clone the ctags repository:
gh repo clone arduino/ctags
-
Edit the Source Code
Navigate to the cloned folder and edit thegeneral.h
file to fix a bug. Find the line:# define __unused__ __attribute__((unused))
And replace it with:
//# define __unused__ __attribute__((unused)) # define __unused__
-
Build and Install ctags
Next, configure and make the build:cd ctags # Navigate to the cloned ctags directory ./configure make
Before replacing the existing ctags, back it up first:
mv ~/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags ~/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags.bak
Then, copy the newly built ctags to the Arduino package directory:
cp ctags ~/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/
Step 3: Install avrdude
-
Install avrdude Using Homebrew
Just like before, install avrdude using:brew install avrdude
After installation, copy the entire avrdude folder into the Arduino tools directory:
cp -r /opt/homebrew/Cellar/avrdude/8.0 ~/Library/Arduino15/packages/arduino/tools/avrdude
-
Locate and Copy the avrdude.conf File
The necessary configuration file may be located at:/opt/homebrew/etc/avrdude.conf
Create a directory for the configuration file within the Arduino tools structure:
mkdir ~/Library/Arduino15/packages/arduino/tools/avrdude/8.0/etc cp /opt/homebrew/etc/avrdude.conf ~/Library/Arduino15/packages/arduino/tools/avrdude/8.0/etc/avrdude.conf
Step 4: Update Arduino IDE Configuration
-
Quit Arduino IDE
Make sure to exit the Arduino IDE completely. -
Edit platform.local.txt
Open your favorite text editor and create a new file. Add the following lines to configure the IDE to use the new tools:compiler.path={runtime.tools.avr-gcc-9.4.0_1.path}/bin/ tools.avrdude.cmd.path={runtime.tools.avrdude-8.0.path}/bin/avrdude tools.avrdude.config.path={runtime.tools.avrdude-8.0.path}/etc/avrdude.conf
Make sure to save the file to:
~/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/platform.local.txt
(Remember, the Library folder is hidden by default; press
Command + Shift + .
to make it visible.)