⏱️ Reading time: 7 min
Running XNU on Linux, Apple’s real macOS kernel embedded inside a Linux kernel, sounds like a trick: xnulinux does not emulate or virtualize anything, it loads XNU as a module inside an unmodified Linux kernel. The project, published by AFK-surf, compiles XNU from the source code Apple publishes and turns it into xnu.ko, a module that insmod loads like any other driver (AFK-surf/xnulinux).
📑 En este artículo
- What XNU Is and What Changes When It Becomes a Module
- How XNU Runs on Linux Without a Hypervisor
- How Far It Runs Today: Two Configurations, Not a Universal Desktop
- What We Tested: Our Sandbox Did Not Even Compile
- xnulinux Compared to Other Ways to Run macOS Outside Apple Hardware
- Limitations and When Not to Use It
- What This Means for You
- References
The promise needs a caveat before going further. Today xnulinux only boots in two very specific configurations, both on arm64, and our own test in an x86_64 Linux sandbox did not even get to compile. Here is what already works, what does not yet, and why loading a kernel as a module is a different way of giving Linux another operating system’s “personality”.
What XNU Is and What Changes When It Becomes a Module
XNU is the hybrid kernel used by macOS, iOS and the rest of Apple’s operating systems: it combines a Mach microkernel with a BSD-style subsystem for processes, files and networking. Apple publishes that code as part of its open source project, though the rest of the system (WindowServer, Dock, Finder) remains proprietary.
Normally XNU runs directly on a Mac’s hardware, or inside a full virtual machine like the ones Apple Virtualization Framework offers. xnulinux proposes a third way: compile XNU so that, instead of being the machine’s main kernel, it loads as a module inside an already-running Linux, the same way a network or disk driver loads (AFK-surf/xnulinux).
How XNU Runs on Linux Without a Hypervisor
The piece that makes this possible is fki.ko, the foreign kernel interface. Linux lends XNU its memory, timers, files, network and GPU through this module, and XNU behaves like a tenant requesting resources instead of the hardware’s exclusive owner (AFK-surf/xnulinux).
Each CPU macOS uses is actually a Linux kernel thread pinned to a physical core. XNU runs on that thread until it needs something only Linux can provide: an interrupt, a disk read, a timer. At that point it makes a call to the host and Linux resolves the request without going through a full hypervisor; these are two kernels taking turns sharing the same CPUs, not a virtual machine (AFK-surf/xnulinux).
flowchart TD
A["macOS processes: WindowServer, Dock, Safari"] --> B["XNU, compiled from Apple's sources"]
B --> C["xnu.ko: module loaded with insmod"]
C --> D["fki.ko: memory, timer, network and GPU interface"]
D --> E["Linux: unpatched stock kernel"]
F["Linux processes: systemd, sshd"] --> E
How Far It Runs Today: Two Configurations, Not a Universal Desktop
The repository itself is upfront about the scope: xnulinux works on two validated setups, both on arm64. The first is a Mac with Apple Silicon running a Linux VM via krunkit, with 1 to 6 hosted CPUs. There, macOS 27.2.1 boots to the desktop with auto-login in 31 to 48 seconds, versus 49 seconds for an equivalent VM built with Apple Virtualization Framework on the same machine. A 30-minute stress test, with 40 rounds of Safari, Notes, Calculator, TextEdit, System Settings, Spotlight and a disk walk-through, finished without a panic or crash report (AFK-surf/xnulinux).
The second setup is bare metal: an NVIDIA DGX Spark with Ubuntu 24.04.5 LTS arm64, where xnulinux boots the full desktop with 4 CPUs and 8 GiB of RAM reserved, reachable over Screen Sharing and SSH. But rendering runs in software (Mesa lavapipe), because the GPU bridge only forwards virtio-gpu Venus calls and that machine’s GB10 needs a new DRM backend that does not exist yet (AFK-surf/xnulinux). A comment in the Hacker News thread puts it plainly: “the article says DGX Spark works but with software rendering” (kccqzy on Hacker News).
What is missing, at least for now, is x86 support. The repository’s issue #10 asks for exactly that, a variant for Intel or AMD processors, and it remains open (issue #10).
What We Tested: Our Sandbox Did Not Even Compile
We tried cloning and running xnulinux in an isolated environment with Linux-6.18.15+deb13-cloud-amd64-x86_64, Python 3.12.16, Node v18.20.4 and git 2.39.5, with no virtualization or special network isolation. In our test we ran:
git -c protocol.allow=never -c protocol.https.allow=always -c core.hooksPath=/dev/null clone --depth 1 --single-branch --no-tags -- https://github.com/AFK-surf/xnulinux /tmp/lab-runs/lab-7c_gkf7n/w/repo
Cloning into '/tmp/lab-runs/lab-7c_gkf7n/w/repo'...
The clone took 2.312 s for a 5.3 MB repository, with a peak memory of 56.1 MB. But the lab’s next step failed with a simple message: no supported stack detected. That makes sense: our sandbox is x86_64, and xnulinux only has a build path designed for arm64 Linux with krunkit or native Arm hardware, so it did not even get to identify which build command to run. This is as valid a result as a successful build: it confirms, from outside the repository, how narrow the platform matrix it supports today actually is.
xnulinux Compared to Other Ways to Run macOS Outside Apple Hardware
xnulinux is not the only way to run macOS without buying extra hardware. Two comparisons matter: the alternative it uses as its own benchmark, and a project that attacks the same problem from a different angle.
| Project | How macOS Runs | Hypervisor | Platform |
|---|---|---|---|
| xnulinux | Real XNU, compiled by the user, loaded as a Linux module | No, direct calls to the host | arm64 Linux (krunkit or validated bare metal) |
| Apple Virtualization Framework / krunkit | Full virtual machine with real XNU | Yes | Apple Silicon (host) or Linux arm64 (krunkit) |
| Darling | Translates Mach-O and system calls to Linux in user space, with no real XNU kernel | No, but there is no Apple kernel either | Linux x86_64 and arm64 |
The underlying difference is which kernel makes the decisions. xnulinux and krunkit both run the same XNU that Apple compiles, so they inherit its compatibility with native apps; krunkit pays the cost of a full hypervisor, xnulinux avoids it in exchange for Linux lending it resources directly. Darling, by contrast, never runs XNU at all: it translates macOS system calls to their Linux equivalents in user space, which lets it run some binaries without a dedicated GPU or arm64, but without a real kernel’s compatibility behind it.
Limitations and When Not to Use It
For anyone without a Mac on Apple Silicon or an arm64 server on hand, xnulinux is not an option today: there is no x86 variant and the issue requesting one is still unresolved (issue #10). It is not a shortcut either if what you need is consistent graphics acceleration: it only has that when a virtio-gpu Venus backend is available, and the validated bare metal setup itself (DGX Spark) still renders in software.
The project still requires a macOS system disk made with Apple’s official installer, so it does not sidestep the EULA or macOS’s usual license restrictions. With about 1,260 stars as of 2026-11-23 (AFK-surf/xnulinux), interest is real, but it is still a 262-commit project (AFK-surf/xnulinux) with only two validated configurations: it is best treated as a kernel-engineering experiment, not a production-ready replacement for a macOS VM.
What This Means for You
If you work on kernels, drivers or hypervisors and care about how an interface between two operating systems gets designed without full virtualization, fki.ko is a concrete reference for that pattern: calls to the host instead of hypervisor traps, interrupts forwarded rather than emulated. Reading linux64_abi.h in the repository is the fastest way to see exactly what XNU asks for and how Linux answers it (AFK-surf/xnulinux).
If instead you are looking for a lighter macOS VM for CI testing or development, it does not replace krunkit or Apple Virtualization Framework yet: it only runs in two specific configurations, GPU acceleration depends on a backend that is missing for hardware like the GB10, and our own test outside arm64 did not get past “no supported stack detected”. The sensible move is to follow issue #10 and the repository before planning anything around this for production.
References
- AFK-surf/xnulinux: repository, README and project status.
- Issue #10: open request for an x86 variant.
- Hacker News thread: community discussion about xnulinux.
- Comment by kccqzy on Hacker News: clarifies that the DGX Spark renders in software.
Featured image: Foto de Luca Bravo en Unsplash
How each article is made (sources, testing and editorial criteria): How we work.
Did it work for you? Got a different error? Say so below: questions get answered and help the next reader.
Leave a comment
0 Comments