How do you install QMK with the new Mac M1 (ARM) chip?

3.5k Views Asked by At

I keep getting compiling errors whenever I follow the Homebrew install guide for QMK.

==> Installing qmk from qmk/qmk
avr-gcc@8: The x86_64 architecture is required for this software.
Error: An unsatisfied requirement failed this build.

How can I get this to install correctly?

3

There are 3 best solutions below

5
Ryan Macdonald On

Install Homebrew using Rosetta 2 to do the compilation for you:

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

Then, install QMK with the x86_64 arch:

arch -x86_64 brew install qmk/qmk/qmk

Then follow the rest of the guide from the QMK website: https://beta.docs.qmk.fm/tutorial/newbs_getting_started#3-run-qmk-setup-id-set-up-qmk.

0
Paint Laurent On

Error: Cannot install under Rosetta 2 in ARM default prefix (/opt/homebrew)!

To rerun under ARM, use:

arch -arm64 brew install ...

To install under x86_64, install Homebrew into /usr/local.

1
Jean-Pascal J. On

I use Docker (Podman actually, but both works) as the container can be amd64 with Rosetta and Podman (there is a solution for Docker too).

Then I build an image like that, and I run inside the container (I override the default keyboard layout with mine, so that I don't have to create a user).

When you run it, mount a volume from your machine as '/output' and copy the bin or do a podman/docker copy.

FROM docker.io/qmkfm/base_container:latest
RUN pip install qmk && \
    qmk setup -y -H /qmk_firmware
WORKDIR /qmk_firmware
COPY keymap/keymap.c /qmk_firmware/keyboards/novelkeys/nk65/keymaps/default/keymap.c
COPY config/qmk/qmk.ini /root/.config/qmk/qmk.ini

# Make Bash as the default command
CMD ["/bin/bash"]