Skip to content

release : publish macOS CLI binaries (arm64, x64, universal) - #4029

Closed
apollo-2006 wants to merge 2 commits into
ggml-org:masterfrom
apollo-2006:ci/macos-release-binaries
Closed

apollo-2006 wants to merge 2 commits into
ggml-org:masterfrom
apollo-2006:ci/macos-release-binaries

Conversation

@apollo-2006

@apollo-2006 apollo-2006 commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4026.

Adds two jobs to release.yml:

  • macos-cpu - arm64 on macos-26, x86_64 on macos-15-intel
  • macos-universal - lipo-fuses the two into a universal tree

Three archives, plus a SHA256SUMS manifest covering the whole release and a
README section on using the binaries. Each archive is smoke-tested on its own
runner before upload, from an extracted copy rather than from build/bin, so
the test exercises what actually ships and @loader_path resolving the dylibs
once the tree has moved off the machine that built it.

One archive for every Mac

GGML_BACKEND_DL=ON with GGML_CPU_ALL_VARIANTS=ON , the same approach as
ubuntu-cpu's x64 leg, applied to both architectures here. Backends are
loadable modules, one per micro-architecture, chosen at load time rather than
at build time. ggml ships three Apple variants; apple_m1 (DOTPROD),
apple_m2_m3 (+MATMUL_INT8), apple_m4 (+NOSVE, SME). Therefore, a single archive
runs on an M1 without giving up the newer instructions on an M4.

GGML_NATIVE has to be off for any of that to apply. Left on, the build
produces one backend compiled for the machine it happened to run on: on a
refreshed arm64 image that is -mcpu=native+dotprod+i8mm+nosve+sme, which will
not start on an M1. Rather than assume the CMake path, I checked the flags
actually emitted per variant with GGML_NATIVE off:

apple_m1     -march=armv8.2-a+dotprod
apple_m2_m3  -march=armv8.6-a+dotprod+i8mm
apple_m4     -march=armv9.2-a+dotprod+i8mm+nosve+sme

The cost is size, and it lands almost entirely on x86: 4.3M → 9.9M for x64 and
8.5M → 15M for universal, against 4.3M → 4.9M for arm64, since ggml ships three
Apple variants and fourteen x86 ones. That is the price of
one-archive-runs-everywhere, and it is what llama.cpp's ubuntu-cpu archives
already pay.

No ggml-org workflow currently builds GGML_CPU_ALL_VARIANTS on Apple, so this
would be the first.

Metal and the universal fuse

Metal is on for arm64 with an embedded library and off for x64, matching
llama.cpp for the reason llama.cpp gives: the hosted Intel runners have no GPU.

Between that and the per-variant CPU backends, the CPU and Metal modules each
exist on exactly one side of the fuse. So the fuse walks the union of both
trees rather than either one alone, files present on both sides are lipo'd,
one-sided backends are copied through thin, and anything else that is one-sided
fails the job instead of disappearing from the archive quietly. Iterating a
single tree would have shipped a universal binary with no x86_64 CPU backend
at all. Backends that do exist on both sides come out fat as normal;
libggml-blas.so is built against Accelerate on each architecture and fuses to
x86_64 arm64.

Copying the one-sided backends through thin is what GGML_BACKEND_DL expects:
the loader scans the directory for backend modules, dlopens each one, and
skips the ones that fail.

A Verify step re-checks the fused tree with lipo -archs, requiring every
non-backend Mach-O to carry both slices; backends are reported with their arch
rather than asserted on.

Probably worth a line in the release notes so nobody reports the thin backend
modules in the universal archive as a bug.

Runner choice

macos-13 became fully unsupported in December 2025. macos-15-intel is the
replacement Intel label, available until August 2027, after which Actions drops
x86_64 entirely and actions/runner-images#13046 states that it will be "the
last available x86_64 image from Actions." llama.cpp's release workflow already
uses both macos-26 and macos-15-intel. Using the native Intel label means
the x64 build is tested on real hardware rather than only cross-compiled.

Checksums

One SHA256SUMS manifest covering every platform, written after the
attestation step so the attested subjects stay exactly the artifacts
themselves. shasum -a 256 -c SHA256SUMS checks a full download in one pass;
--ignore-missing does the same for a single archive.

This also fixes a bug in the earlier revision of this PR: the per-artifact
.sha256 files never reached the release, because the asset upload filter in
the release job accepts only .zip and .tar.gz and dropped them without a
warning. SHA256SUMS is added to that filter explicitly.

README and Gatekeeper

New ### Prebuilt macOS binaries subsection: verify against SHA256SUMS,
extract, run.

The archives are adhoc/linker-signed, not Developer ID signed, not notarized.
macOS quarantines anything downloaded through a browser, and Finder propagates
that flag onto the files it extracts, so Gatekeeper then refuses to run them.
Extracting with tar sidesteps it entirely; xattr -dr com.apple.quarantine
is documented as the fallback for people who use Finder.

As offered in #4026, I'm happy to wire codesign and notarytool in behind a
secrets check so the steps no-op on forks, but that needs a Developer ID on the
project's Apple account, which I can't supply.

Verification

Both macOS jobs run green on my fork:
run 33704402855
on macos-26 and macos-15-intel, with macos-universal passing its fuse,
verify and smoke-test steps. Run from a scratch branch with the non-macOS jobs
stripped and should_release forced; the two job definitions themselves are
unmodified.

The rest could not come from hosted runners, so it was done locally: Apple M4,
macOS 26.6.2, Apple clang 21.0.0, both architectures built with the workflow's
exact flags and fused with the workflow's own script.

  • Fused tree: 22 non-backend Mach-O files, all universal, and 19 backend
    modules, 18 thin, plus libggml-blas.so fat. Zero errors from the verify
    step.
  • Load-time variant selection demonstrated across three machines with the same
    archive. On the macos-26 runner, an Apple Paravirtual GPU, reporting
    MTLGPUFamilyApple5, it loads libggml-cpu-apple_m1.so. On a local M4 it
    loads libggml-cpu-apple_m4.so. Under Rosetta its x86_64 slice loads
    libggml-cpu-sse42.so; Rosetta exposes no AVX2, so a real Intel Mac lands on
    haswell or better. One archive, three variants, selected at load time
    rather than pinned at build time.
  • All three archives extracted standalone and ran: rpath @loader_path,
    install names @rpath/…, minos 13.3 on both slices, symlinks preserved
    through both the fuse and the tar.
  • Backends for the other architecture fail to load silently rather than
    printing errors: ggml_backend_load_all_from_path sets silent = true
    under NDEBUG.
  • SHA256SUMS round-trips, excludes itself, and the README one-liner exits 1
    on a corrupted file.

@apollo-2006
apollo-2006 force-pushed the ci/macos-release-binaries branch 4 times, most recently from 81d19dd to 163e578 Compare September 3, 2026 02:07
@apollo-2006
apollo-2006 marked this pull request as ready for review September 3, 2026 02:07
Copilot AI lite review requested due to automatic review settings September 3, 2026 02:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes the release pipeline with new macOS build/fuse logic that should be validated via end-to-end workflow runs before approval.

Pull request overview

Adds macOS CLI binary publishing to the existing release workflow, producing separate arm64/x86_64 archives plus a fused universal archive, and documents how to consume these artifacts from GitHub Releases.

Changes:

  • Add macos-cpu build+pack+smoke-test job for arm64 (macos-26) and x64 (macos-15-intel) with GGML_BACKEND_DL and GGML_CPU_ALL_VARIANTS.
  • Add macos-universal job to fuse thin arm64/x64 trees into a universal archive with lipo, plus verification and smoke test.
  • Generate a single SHA256SUMS manifest for all release artifacts and document macOS binary usage / Gatekeeper notes in README.
File summaries
File Description
README.md Documents downloading/verifying/extracting/running the prebuilt macOS CLI archives and Gatekeeper quarantine handling.
.github/workflows/release.yml Adds macOS build jobs (arm64, x64, universal) and generates/uploads a consolidated SHA256SUMS asset.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/release.yml Resolved
Comment thread README.md Resolved
@apollo-2006

Copy link
Copy Markdown
Contributor Author

Rebased onto master and added a ctest step to macos-cpu.

release.yml sets GGML_BACKEND_DL=ON and runs no tests, which is half of why #4030 shipped. macos-cpu is also the only place that flag meets GGML_CPU_ALL_VARIANTS=ON on Apple hardware, and nothing in CI exercises that pair. One step closes both. Independent of #4047, which adds the same coverage to build-clang.yml.

New step in job macos-cpu, between Build and Pack artifacts:

- name: Test
  run: ctest --test-dir build -L gh --output-on-failure

This step was in the PR originally and came out when the job aborted.

It goes before Pack artifacts so a broken build fails the job instead of shipping. The existing Smoke test step stays: running the extracted archive answers a different question from whether the tests pass.

Why the rebase was needed

The step does not pass on this branch without it. The PR branched before #4031 merged, so its tests/*.cpp had no ggml_backend_load_all() call and the step aborted exactly as #4030 describes: GGML_ASSERT(device) in ggml_backend_dev_backend_reg at ggml-backend.cpp:595, taking ctest -L gh to 2 of 4 on test-whisper-zero-samples and test-parakeet. Rebasing picks up the fix. The rebase was clean and left the PR's own diff untouched; the ctest step adds 3 lines on top, taking it from +251/-1 to +254/-1.

Verification

Fork run 34254757601, both legs green on the rebased branch. ctest -L gh runs test-whisper-cli-tiny, test-whisper-buffer-loader, test-whisper-zero-samples and test-parakeet, and both legs report 100% tests passed out of 4:

runner build ctest total test time
macos-26 arm64 4 of 4 39.81 s
macos-15-intel x64 4 of 4 4.30 s

Four tests and no model downloads, so the cost is the time above. release.yml is workflow_dispatch only, so this cannot turn a PR red. Scoped to macos-cpu; the other release.yml jobs are a separate question and I have not touched them.

@apollo-2006
apollo-2006 marked this pull request as ready for review September 8, 2026 17:26
Adds two jobs to release.yml. macos-cpu builds arm64 on macos-26 and
x86_64 on macos-15-intel; macos-universal lipo-fuses the two trees into
a universal archive. Three tarballs, each smoke-tested from the
extracted archive on its own runner before upload, so the test covers
@loader_path resolving the dylibs once the tree has left the build
machine.

Uses GGML_BACKEND_DL with GGML_CPU_ALL_VARIANTS, one CPU backend per
micro-architecture selected at load time. GGML_NATIVE has to stay off
for the per-variant flags to apply at all; with it off the Apple
variants (apple_m1, apple_m2_m3, apple_m4) cover dotprod, i8mm and SME
in a single archive instead of pinning the build to whichever CPU the
runner happened to have.

The CPU and Metal modules are therefore one-sided, Metal being arm64
only. The fuse walks the union of both trees: matched files are lipo'd,
one-sided backends are copied through thin, and anything else that is
one-sided fails the job rather than vanishing from the archive. A verify
step then requires every non-backend Mach-O to carry both slices,
checked with lipo -archs.

The release job writes a single SHA256SUMS manifest covering every
platform. The asset upload filter only accepted .zip and .tar.gz, so
SHA256SUMS is added to it explicitly.

README gains a section on the prebuilt macOS archives, including the
Gatekeeper quarantine flag, since the archives are unsigned.
@apollo-2006

apollo-2006 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@danbev Me again! 😅 Hope you're having a good week.

#4005 frames the goal as the same pre-release clean-up llama.cpp did, so measuring this PR against that:

The two thin jobs match llama.cpp line for line, on the same runner pair. llama.cpp already ships a macos-cpu binary and whisper.cpp ships no macOS CLI binary at all, so that part is straight parity.

macos-universal is not. llama.cpp has no lipo anywhere, and that job is 130 of the 253 lines this PR adds.

So: strict parity, and I drop the universal job? Or is the universal archive something you want here?

@apollo-2006 apollo-2006 closed this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release: publish macOS CLI binaries

2 participants