How to avoid installing Rosetta on an Apple Silicon Mac

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

  1. 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
    
  2. 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/
    
  3. 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

  1. 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
    
  2. Edit the Source Code
    Navigate to the cloned folder and edit the general.h file to fix a bug. Find the line:

    # define __unused__  __attribute__((unused))
    

    And replace it with:

    //# define __unused__  __attribute__((unused))
    # define __unused__
    
  3. 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

  1. 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
    
  2. 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

  1. Quit Arduino IDE
    Make sure to exit the Arduino IDE completely.

  2. 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.)

Final Step: Restart the Arduino IDE

What? I just downloaded the Apple Silicon version, works fine. MacAir M3.

Have you enabled Rosetta for some other program? This is only if you don't want to have things run through Rosetta. Unless an update came out in the two weeks since I cobbled this together.

Surely a "clone" is more than you need? (although perhaps it's easier to do from the cli.)

avr-gcc version 9.4.0_1 is the latest.

The "latest avr-gcc" has added new chips via a "packs" mechanism. Arduino has instead added them to the avr distribution itself. If you want to use, say, a Nano Every (with ATmega4809), you'll probably need to move some files around.

Locate and Copy the avrdude.conf File

Why? I'd think the existing arduino avrdude.conf would work fine with the newer avrdude, and it might have additions not in the standard release (that are still compatible with avrdude itself.)

@westkf Maybe these optimizations would be better, but…not sure! I just wanted the IDE to work natively on Apple Silicon, and it hasn't seemed to be done in the four years these CPUs have been around, so this worked for me.

I didn't have Rosetta until 5 days ago and I have had this Mac with Arduino for about a year.

Thanks for sharing this information @jpurnell!


In case it will be useful to others who are interested in this subject, I'll add a couple releated links:

The Arduino developers are tracking the request for distribution of native Apple Silicon builds of Ctags here:

And for the AVR toolchain here:

If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:


:exclamation: Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.


Is this guide current and up to date?

I did not complete successfully: bad CPU etc.

eg it seems the github enhancement request was almost immediately closed.

is gh required? ie rather than git, which doesn’t require login/password

my particular board is Arduino Uno R4 Wifi with ESP32 S3, and other ESP32 S3 boards

alternate: Add native support for Apple Silicon · Issue #408 · arduino/arduino-ide · GitHub

thanks

As I work through it, it seems:

cp -r /opt/homebrew/Cellar/avrdude/8.0 ~/Library/Arduino15/packages/arduino/tools/avrdude

maybe contain a typo, should be

cp -r /opt/homebrew/Cellar/avrdude/ ~/Library/Arduino15/packages/arduino/tools/avrdude

Thanks @jpurnell! This guide worked perfectly on an M4 Pro mac where I don't want to install Rosetta. I did notice that some avr-gcc utils are now split out into a separate homebrew package so I just had to add a step to symlink those. Since some folks asked about using git and wondered if this guide is current I'll share the full set of steps I used:

Dependencies:

  • XCode command-line tools

    xcode-select install
    
  • Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    

1. Install and link avr-gcc

This step is identical to the original just updated to reflect the current version (9.5.0).

$ brew tap osx-cross/avr
$ brew install avr-gcc
$ ls /opt/homebrew/Cellar/avr-gcc@9
9.5.0
$ ln -s /opt/homebrew/Cellar/avr-gcc@9/9.5.0 ~/Library/Arduino15/packages/arduino/tools/avr-gcc/9.5.0

2. Link additional avr utils

Additional step -- These utils (at least avr-objcopy) are required to upload the compiled sketch to the board. The IDE expects them in the arv-gcc/bin directory so we need to symlink them to that location. Note the version numbers will change over time.

$ ls /opt/homebrew/Cellar/avr-binutils
2.45.1
$ ln -s /opt/homebrew/Cellar/avr-binutils/2.45.1/bin/* ~/Library/Arduino15/packages/arduino/tools/avr-gcc/9.5.0/bin/

3. Patch and build ctags

This step is nearly identical to the original guide, however I use git instead of the gh CLI.

$ git clone https://github.com/arduino/ctags
$ cd ctags
$ sed -i bak 's/# define __unused__  __attribute__((unused))/# define __unused__/' general.h
$ rm *bak
$ ./configure
$ make
$ mv ~/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags ~/Library/Arduino15/packages/builtin/tools/cctags/5.8-arduino11/ctags.bak
$ cp ctags ~/Library/Arduino15/packages/builtin/tools/ctags/5.8-arduino11/

4. Install and link avrdude

Again, identical to the original with updated version.

$ brew install avrdude
$ ln -s /opt/homebrew/Cellar/avrdude/8.1 ~/Library/Arduino15/packages/arduino/tools/avrdude
$ mkdir ~/Library/Arduino15/packages/arduino/tools/avrdude/8.1/etc
$ ln -s /opt/homebrew/etc/avrdude.conf ~/Library/Arduino15/packages/arduino/tools/avrdude/8.1/etc/avrdude.conf

5. Update Arduino IDE config

Finally, create/edit ~/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/platform.local.txt just like the orignal guide:

compiler.path={runtime.tools.avr-gcc-9.5.0.path}/bin/
tools.avrdude.cmd.path={runtime.tools.avrdude-8.1.path}/bin/avrdude
tools.avrdude.config.path={runtime.tools.avrdude-8.1.path}/etc/avrdude.conf

Note: version numbers will change with time