Static builds of ONNX Runtime for macOS as one universal
libonnxruntime.a (arm64 + x86_64), for Rust projects that use the
ort crate.
ort-sys downloads prebuilt ONNX Runtime libraries at build time, but there is no
prebuilt for Intel Macs (x86_64-apple-darwin). This repository builds one from the
upstream source, so a universal macOS app can link ONNX Runtime on both architectures.
curl -fsSLO https://github.com/smart-ssh/onnxruntime-macos/releases/download/v1.31.0-r1/onnxruntime-1.31.0-macos-universal-static.tar.gz
shasum -a 256 -c <<< "<sha256 from the release> onnxruntime-1.31.0-macos-universal-static.tar.gz"
tar xzf onnxruntime-1.31.0-macos-universal-static.tar.gz
export ORT_LIB_LOCATION="$PWD/onnxruntime-1.31.0-macos-universal-static"
cargo build --target x86_64-apple-darwin # or aarch64-apple-darwin, or a universal buildWith ORT_LIB_LOCATION set, ort-sys downloads nothing and links
libonnxruntime.a statically. The ort version must expect the same ONNX Runtime
version: ort-sys names it in build/download/dist.tsv (ms@<version>).
Each archive contains libonnxruntime.a, ONNX Runtime's LICENSE and
ThirdPartyNotices.txt, the list of combined libraries per architecture and
BUILDINFO (upstream commit, minimum macOS, build run).
- ONNX Runtime version, upstream commit and minimum macOS:
ort-version.env - CPU execution provider only, Release, no tests, no telemetry (
--no_telemetry) - Both architectures are built on an Apple Silicon runner (x86_64 cross-compiled),
combined with
libtool/lipo, then a small C program links each slice and loads a model (the x86_64 one under Rosetta)
The upstream repository github.com/microsoft/onnxruntime has been unreachable since
mid-November 2026. scripts/fetch-source.sh tries it first
and otherwise fetches the same tree from the
Software Heritage archive. In both cases the
source is used only if its git tree hash matches ORT_TREE, i.e. the files are
exactly those of the upstream tag. Third-party dependencies come from
cmake/deps.txt of that source, each pinned by SHA1.
- Update
ort-version.env(version, commit, tree, submodule gitlinks). - Run the
buildworkflow manually withpublishenabled. To republish the same ONNX Runtime version, raiserevision.
The build scripts are MIT licensed (LICENSE). ONNX Runtime is MIT licensed by Microsoft; its license and third-party notices ship in every archive.