Run macOS userspace on Linux by loading the macOS kernel into it.

xnulinux builds XNU, the open-source kernel of macOS, from Apple's published sources and runs it as a loadable kernel module (xnu.ko) inside an unmodified arm64 Linux kernel. The hosted XNU drives the CPU and MMU directly, so macOS processes run natively next to Linux processes on the same CPUs, with no hypervisor between them. Linux lends XNU its memory, timers, files, network and GPU through a small interface module (fki.ko).

With a stock Ubuntu kernel, insmod xnu.ko boots a macOS 27 system disk made by Apple's own installer to the desktop: loginwindow, WindowServer, Dock, Finder, Safari and Chrome. (Related: Tech Report: Porting fairseq wmt19 translation system t...)

Recent findings suggest that one system, two userspaces. Left: a Terminal in the hosted macOS 27.2.1 (sw_vers, the Darwin kernel, launchd, WindowServer, Dock and Finder running). Right: from that macOS, an SSH session into the Linux it runs inside (Ubuntu, Linux 7.0, the xnu and fki modules loaded, and the insmod xnu.ko process the macOS kernel runs in). Straight from the hosted framebuffer, 1280×800.

The hosted desktop at the end of a 30-minute stress run, rendered on the CPU (no GPU bridge).

Safari in the hosted macOS: Wikipedia's article on XNU, kernel.org and the Linux repository on GitHub, over the hosted system's network link through Linux, with the GPU bridge on (GPU=auto).

Bare-metal NVIDIA DGX Spark (Ubuntu 24.04.5 LTS aarch64, Linux 7.0.0-1025-nvidia): hosted macOS 27 running with 4 CPUs and 8 GiB of RAM (CPU rendering), shown over macOS Screen Sharing alongside an SSH session from the DGX Spark host into the hosted Darwin userspace.

Inside the hosted macOS on DGX Spark: About This Mac (Chip: Unknown, 7.80 GB memory, macOS Golden Gate 27.2) alongside sysctl machdep.cpu (ARM processor, hw.cpufamily: 0, hw.ncpu: 4) and hw.optional.arm.

Working on two arm64 Linux setups:.

According to recent reports, what is still a stopgap is listed in docs/production.md. Notably: the OS cryptex is merged into the system volume, AMFI is patched and SIP relaxed, and memory access is slower than a native VM (4K pages vs 16K).

The Linux side and the XNU side are kept apart by license and meet only at FKI. Every source file carries an SPDX-License-Identifier; the license texts are in LICENSES/.

xnu.ko is on the XNU side of the line: it runs XNU's code in its own address space, so it is APSL-2.0 like XNU, and Linux reports it as a non-GPL module (MODULE_LICENSE("Proprietary"), which taints the kernel as ZFS does). It must not include Linux headers beyond the module ABI, call Linux functions other than fki_*, or carry Linux code. Upstream code (XNU, macOS-DroidVM's toolchain, Mesa, metal2vulkan, the Vulkan loader, LLVM) is fetched at pinned revisions and patched at build time; it is never committed.

According to recent reports, macOS, Metal and XNU are trademarks of Apple Inc. This project is not affiliated with or endorsed by Apple.

→ Read original article