How to fix GitHub Actions CI failures with Julia 1.6 (or 1.7) on `macos-latest` and `macos-14`

,

GitHub Actions offers three[1] different versions of macOS on the free GitHub-hosted macOS runners:

  • macos-12, which runs on Intel Mac machines (x86_64)
  • macos-13, which runs on Intel Mac machines (x86_64)
  • macos-14, which runs on Apple Silicon Mac machines (aarch64)

GitHub Actions also has a convenience “alias” named macos-latest. Previously, macos-latest was equivalent to macos-12 (Intel). However, in June 2024, GitHub modified the macos-latest label to point to macos-14 (Apple Silicon) instead.

In most cases, this does not cause any problems.

However, older versions of Julia (such as Julia 1.6 and 1.7) do not have native binaries for Apple Silicon macOS. Therefore, if you try to install the native binaries for Julia 1.6 (or 1.7) on macos-latest or macos-14, this will cause an error.

For example, suppose that this is the CI job matrix in your workflow YAML file:

matrix:
  github-runner:
    - ubuntu-latest
    - windows-latest
    - macos-latest # Apple Silicon
  julia-version:
    - '1.6'
    - '1.10'

And suppose that this is the runs-on line in your workflow YAML file:

runs-on: ${{ matrix.github-runner }}

And suppose that this is how you are invoking julia-actions/setup-julia to install Julia in your workflow YAML file:

- uses: julia-actions/setup-julia@v2
  with:
    version: ${{ matrix.julia-version }}

The Julia 1.6 job will error on macos-latest (but will work fine on ubuntu-latest and windows-latest). (The Julia 1.10 job will work fine on all three runners.)

In order to fix this error, you have four options:

  1. Option 1: Change macos-latest (Apple Silicon) to macos-13 (Intel) for all Julia versions.
  2. Option 2: Exclude only the Julia 1.6 job on macos-latest (Apple Silicon), and run the Julia 1.6 job on macos-13 (Intel) instead.
  3. Option 3: Use Rosetta 2 emulation to run an x86_64 build of Julia 1.6 on macos-latest (Apple Silicon).
  4. Option 4: Combine options 2 and 3: run a native (x86_64) build of Julia 1.6 on macos-13 (Intel), and then use Rosetta 2 emulation to run an x86_64 build of Julia 1.6 on macos-latest (Apple Silicon).

Here are the instructions for each of those options:

Option 1: Change macos-latest (Apple Silicon) to macos-13 (Intel) for all Julia versions.

Change your matrix to look like this:

matrix:
  github-runner:
    - ubuntu-latest
    - windows-latest
    - macos-13 # Intel
  julia-version:
    - '1.6'
    - '1.10'

Option 2: Exclude only the Julia 1.6 job on macos-latest (Apple Silicon), and run the Julia 1.6 job on macos-13 (Intel) instead.

Change your matrix to look like this:

matrix:
  github-runner:
    - ubuntu-latest
    - windows-latest
    - macos-latest # Apple Silicon
  julia-version:
    - '1.6'
    - '1.10'
  exclude:
    - github-runner: macos-latest # Apple Silicon
      julia-version: '1.6'
  include:
    - github-runner: macos-13 # Intel
      julia-version: '1.6'

Option 3: Use Rosetta 2 emulation to run an x86_64 build of Julia 1.6 on macos-latest (Apple Silicon).

Change your matrix to look like this:

matrix:
  github-runner:
    - ubuntu-latest
    - windows-latest
    - macos-latest # Apple Silicon
  julia-version:
    - '1.6'
    - '1.10'
  julia-arch:
    - ''
  exclude:
    - github-runner: macos-latest # Apple Silicon
      julia-version: '1.6'
      julia-arch: ''
  include:
    - github-runner: macos-latest # Apple Silicon
      julia-version: '1.6'
      # Install an x86_64 build of Julia, and run it under Rosetta 2 emulation
      julia-arch: 'x64'

And change your invocation of setup-julia to look like this:

- uses: julia-actions/setup-julia@v2
  with:
    version: ${{ matrix.julia-version }}
    arch: ${{ (matrix.julia-arch == '') && runner.arch || matrix.julia-arch }}

Option 4: Combine options 2 and 3: run a native (x86_64) build of Julia 1.6 on macos-13 (Intel), and then use Rosetta 2 emulation to run an x86_64 build of Julia 1.6 on macos-latest (Apple Silicon).

Change your matrix to look like this:

matrix:
  github-runner:
    - ubuntu-latest
    - windows-latest
    - macos-latest # Apple Silicon
  julia-version:
    - '1.6'
    - '1.10'
  julia-arch:
    - ''
  exclude:
    - github-runner: macos-latest # Apple Silicon
      julia-version: '1.6'
      julia-arch: ''
  include:
    - github-runner: macos-13 # Intel
      julia-version: '1.6'
      julia-arch: ''
    - github-runner: macos-latest # Apple Silicon
      julia-version: '1.6'
      # Install an x86_64 build of Julia, and run it under Rosetta 2 emulation
      julia-arch: 'x64'

And change your invocation of setup-julia to look like this:

- uses: julia-actions/setup-julia@v2
  with:
    version: ${{ matrix.julia-version }}
    arch: ${{ (matrix.julia-arch == '') && runner.arch || matrix.julia-arch }}

I am going to make an update to the setup-julia action so that it prints a better error message (including a link to this Discourse post) when this situation occurs.


  1. GitHub also used to offer macos-11, which ran on Intel Mac machines (x86_64). However, GitHub no longer offers macos-11 on the free GitHub-hosted runners. ↩︎

5 Likes

Thanks so much for the detailed instructions! :star2:

1 Like