XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)

★ 4,408⑂ 232👁 20⑃ 96● 7▤ 0
CNOASSERTIONCreated 2026-11-20
+106
Daily
4,408
stars
232
forks
20
watchers
96
prs
7
issues
0
releases

README

xnulinux

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.

!macOS and Linux userspace side by side

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 macOS desktop

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

| | |
|---|---|
| !Safari on Wikipedia's XNU article | !Safari on kernel.org |
| !Safari on GitHub | |

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).

!Hosted macOS running on bare-metal NVIDIA DGX Spark

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.

!About This Mac and sysctl on bare-metal NVIDIA DGX Spark

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.

 How it works


 macOS processes (launchd, WindowServer, Safari...)    Linux processes (systemd, sshd, xnudrmd...)
 ──────────────────────────────────────────────────    ────────────────────────────────────────────
 XNU (source-built, LINUX64 machine layer, kexts)  │
   ↕ linux64 host calls (xnu-patches/include/linux64_abi.h)
 xnu.ko   (APSL side: loads and runs the kernel collection)
   ↕ FKI, the foreign kernel interface (fki_)
 fki.ko   (GPL side: CPUs, memory, faults, IPIs, files, network, host calls)
 Linux kernel (stock distro kernel, 4K pages, PAC)


- CPUs: each hosted CPU is a Linux kernel thread pinned to a Linux CPU. XNU runs on it until it calls the host
  (idle, I/O, a timer); Linux keeps its own exception vectors, and fki.ko forwards the faults and user exceptions of
  XNU code to XNU's handlers.
- Memory: XNU gets one physically contiguous block from Linux (CMA)

Top issues

Snapshot: 2026-11-28T10:06:57Z · Data license Apache-2.0 · JSON