Repository navigation
release : publish macOS CLI binaries (arm64, x64, universal) - #4029
apollo-2006 wants to merge 2 commits into
Conversation
81d19dd to
163e578
Compare
There was a problem hiding this comment.
🔵 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-cpubuild+pack+smoke-test job forarm64(macos-26) andx64(macos-15-intel) withGGML_BACKEND_DLandGGML_CPU_ALL_VARIANTS. - Add
macos-universaljob to fuse thin arm64/x64 trees into a universal archive withlipo, plus verification and smoke test. - Generate a single
SHA256SUMSmanifest 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.
163e578 to
04beb66
Compare
04beb66 to
95d1369
Compare
|
Rebased onto master and added a
New step in job - name: Test
run: ctest --test-dir build -L gh --output-on-failureThis 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 neededThe step does not pass on this branch without it. The PR branched before #4031 merged, so its VerificationFork run 34254757601, both legs green on the rebased branch.
Four tests and no model downloads, so the cost is the time above. |
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.
95d1369 to
b7063d9
Compare
|
@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
So: strict parity, and I drop the universal job? Or is the universal archive something you want here? |
Closes #4026.
Adds two jobs to
release.yml:arm64onmacos-26,x86_64onmacos-15-intellipo-fuses the two into a universal treeThree archives, plus a
SHA256SUMSmanifest covering the whole release and aREADME 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, sothe test exercises what actually ships and
@loader_pathresolving the dylibsonce the tree has moved off the machine that built it.
One archive for every Mac
GGML_BACKEND_DL=ONwithGGML_CPU_ALL_VARIANTS=ON, the same approach asubuntu-cpu's x64 leg, applied to both architectures here. Backends areloadable 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 archiveruns on an M1 without giving up the newer instructions on an M4.
GGML_NATIVEhas to be off for any of that to apply. Left on, the buildproduces 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 willnot start on an M1. Rather than assume the CMake path, I checked the flags
actually emitted per variant with
GGML_NATIVEoff: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-cpuarchivesalready pay.
No ggml-org workflow currently builds
GGML_CPU_ALL_VARIANTSon Apple, so thiswould be the first.
Metal and the universal fuse
Metal is on for
arm64with an embedded library and off forx64, matchingllama.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_64CPU backendat all. Backends that do exist on both sides come out fat as normal;
libggml-blas.sois built against Accelerate on each architecture and fuses tox86_64 arm64.Copying the one-sided backends through thin is what
GGML_BACKEND_DLexpects:the loader scans the directory for backend modules,
dlopens each one, andskips the ones that fail.
A
Verifystep re-checks the fused tree withlipo -archs, requiring everynon-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-13became fully unsupported in December 2025.macos-15-intelis thereplacement Intel label, available until August 2027, after which Actions drops
x86_64entirely and actions/runner-images#13046 states that it will be "thelast available x86_64 image from Actions." llama.cpp's release workflow already
uses both
macos-26andmacos-15-intel. Using the native Intel label meansthe x64 build is tested on real hardware rather than only cross-compiled.
Checksums
One
SHA256SUMSmanifest covering every platform, written after theattestation step so the attested subjects stay exactly the artifacts
themselves.
shasum -a 256 -c SHA256SUMSchecks a full download in one pass;--ignore-missingdoes the same for a single archive.This also fixes a bug in the earlier revision of this PR: the per-artifact
.sha256files never reached the release, because the asset upload filter inthe release job accepts only
.zipand.tar.gzand dropped them without awarning.
SHA256SUMSis added to that filter explicitly.README and Gatekeeper
New
### Prebuilt macOS binariessubsection: verify againstSHA256SUMS,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
tarsidesteps it entirely;xattr -dr com.apple.quarantineis documented as the fallback for people who use Finder.
As offered in #4026, I'm happy to wire
codesignandnotarytoolin behind asecrets 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-26andmacos-15-intel, withmacos-universalpassing its fuse,verify and smoke-test steps. Run from a scratch branch with the non-macOS jobs
stripped and
should_releaseforced; the two job definitions themselves areunmodified.
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.
modules, 18 thin, plus
libggml-blas.sofat. Zero errors from the verifystep.
archive. On the
macos-26runner, an Apple Paravirtual GPU, reportingMTLGPUFamilyApple5, it loadslibggml-cpu-apple_m1.so. On a local M4 itloads
libggml-cpu-apple_m4.so. Under Rosetta itsx86_64slice loadslibggml-cpu-sse42.so; Rosetta exposes no AVX2, so a real Intel Mac lands onhaswellor better. One archive, three variants, selected at load timerather than pinned at build time.
@loader_path,install names
@rpath/…,minos 13.3on both slices, symlinks preservedthrough both the fuse and the tar.
printing errors:
ggml_backend_load_all_from_pathsetssilent = trueunder
NDEBUG.SHA256SUMSround-trips, excludes itself, and the README one-liner exits 1on a corrupted file.