MacOSX cross toolchain as a Docker image.
Tip
Want to be notified of new releases? Check out 🔔 Diun (Docker Image Update Notifier) project!
This Docker image is not affiliated with Apple Inc. and does not represent Apple's official product, service or practice. Apple is not responsible for and does not endorse this Docker image.
This Docker image is not affiliated with the Xcode project.
Please ensure you have read and understood the Xcode license terms before using it.
git clone https://github.com/crazy-max/docker-osxcross.git
cd docker-osxcross
# Build image and output to docker (default)
docker buildx bake
# Build multi-platform image
docker buildx bake image-all
Registry | Image |
---|---|
Docker Hub | crazymax/osxcross |
GitHub Container Registry | ghcr.io/crazy-max/osxcross |
$ docker buildx imagetools inspect crazymax/osxcross --format "{{json .Manifest}}" | \
jq -r '.manifests[] | select(.platform.os != null and .platform.os != "unknown") | .platform | "\(.os)/\(.architecture)\(if .variant then "/" + .variant else "" end)"'
darwin/amd64
darwin/arm64
linux/amd64
linux/arm64
alpine
, debian
and ubuntu
variants are available for this image with
ubuntu
being the default one.
edge
,edge-ubuntu
edge-debian
edge-alpine
latest
,latest-ubuntu
,xx.x
,xx.x-rx
,xx.x-ubuntu
,xx.x-rx-ubuntu
latest-debian
,xx.x-debian
,xx.x-rx-debian
latest-alpine
,xx.x-alpine
,xx.x-rx-alpine
Note
xx.x
has to be replaced with one of the MaxOSX releases available (e.g. 11.3
).
rx
has to be replaced with a release number (e.g. r6
).
# syntax=docker/dockerfile:1
ARG OSXCROSS_VERSION=latest
FROM --platform=$BUILDPLATFORM crazymax/osxcross:${OSXCROSS_VERSION}-ubuntu AS osxcross
FROM ubuntu
RUN apt-get update && apt-get install -y clang lld libc6-dev
ENV PATH="/osxcross/bin:$PATH"
ENV LD_LIBRARY_PATH="/osxcross/lib:$LD_LIBRARY_PATH"
RUN --mount=type=bind,from=osxcross,source=/osxcross,target=/osxcross \
o64-clang ...
With alpine:
# syntax=docker/dockerfile:1
ARG OSXCROSS_VERSION=latest
FROM --platform=$BUILDPLATFORM crazymax/osxcross:${OSXCROSS_VERSION}-alpine AS osxcross
FROM alpine
RUN apk add --no-cache clang lld musl-dev
ENV PATH="/osxcross/bin:$PATH"
ENV LD_LIBRARY_PATH="/osxcross/lib:$LD_LIBRARY_PATH"
RUN --mount=type=bind,from=osxcross,source=/osxcross,target=/osxcross \
o64-clang ...
darwin/amd64
and darwin/arm64
platforms are also available with the
MacOSX SDK in /osxsdk
if you want to use it as sysroot with your own toolchain
like tonistiigi/xx
:
# syntax=docker/dockerfile:1
ARG OSXCROSS_VERSION=latest
FROM crazymax/osxcross:${OSXCROSS_VERSION}-alpine AS osxcross
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.1.2 AS xx
FROM --platform=$BUILDPLATFORM alpine
COPY --from=xx / /
RUN apk add --no-cache clang lld musl-dev
ARG TARGETPLATFORM
RUN xx-apk add gcc g++ musl-dev
RUN --mount=type=bind,target=. \
--mount=type=bind,from=osxcross,source=/osxsdk,target=/xx-sdk \
xx-clang ...
Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!
Thanks again for your support, it is much appreciated! 🙏
MIT. See LICENSE
for more details.