Setup GitHub Actions Runner on M1 Mac
Getting the full potential of your self-hosted GitHub Actions runner while being on an M1 machine.
Intro
I assume you have a project setup and GitHub actions working. However, you can’t seem to figure out why the self-hosted runner issn’t using the full potentional of the M1. This is where this article comes in.
Background
Over my years as a developer my interest in continous integration and continuous deployment has increased from year to year, up to a point where I would like to argue that I am rather good at setting up and maintaining a few of the well known CI services on the market. However, GitHub Actions has not been in my aresenal of tools… that is, until now.
Runners
As of the writing of this article, GitHub runners run your code on x86_64 architecture. Meaning if you setup a runner on an M1 on MacOS, it’ll use said architecutre. In order to get the runner to run on arm64, you will have to tell phases in our workflow file to do so.
This is an example of a workflow file which runs using the M1 CPU:
What this does is that is tells the workflow script at each step to perform an action using the arm64 architecture.
The clue is using arch -arm64
when calling commands from your workflow.
If you have build using the runner already, make sure you clean your derived folder so it can make a clean build. It might sometimes also be good to clean the Pods folder (if you are using Cocoapods).