Ray's Knowledge Base
Unlock

Test a GitHub Actions job locally with act on an Apple Silicon Mac and keep the container

RecipeVerified 29 Sep 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.

When to use#

A CI step fails and each push-and-wait round is slow; you want to run the job on your Mac and fix the step in place.

Steps#

  1. Run natively on ARM: Docker on Apple Silicon is aarch64, and x86 emulation is too slow for a big build.

  2. Copy the workflow to a scratch file. Drop steps that touch the host (a docker image prune step would prune your own images) and stop after the step under test.

  3. Run it with the log saved, and --reuse so the container stays after a failure:

    act pull_request -W $S/ci.yml -j build-and-test -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 --container-architecture linux/arm64 --pull=true --reuse > $S/act.log 2>&1; echo "exit $?" >> $S/act.log
    
  4. After a failure, run the corrected step in the kept container, then the later steps, without a full rebuild.

  5. Remove the container when done: docker rm -f <id>.

Evidence#

dftracer PR 388, 2026-09-29: the act run found that libraries were in install/lib, not lib64 as a guess had assumed, and the fixed step then built and linked in the kept container. A container cannot show hardware counters: the PAPI check exited 2 with "PAPI runtime is available but exposes 0 hardware counters on this node".

Also found by searching

  • act pull_request -j build-and-test on M1 Mac extremely slow, x86 emulation, container removed after failure
  • every GitHub Actions fix needs a push and long wait, I want to iterate on the failing step locally on my Mac
  • how do I run a GitHub Actions workflow locally with act on Apple Silicon and keep the container to debug?
  • nektos act --reuse --container-architecture linux/arm64 catthehacker ubuntu image to debug CI step
  • act pull_request -j build-and-test exec format error / too slow on Apple Silicon x86 emulation
  • a GitHub Actions step fails and pushing to retry each time takes forever
  • how do I run a GitHub workflow job locally on my M-series Mac and debug a failing step in the container?
  • nektos act docker arm64 linux/arm64 --reuse keep container after failure