XNU as a loadable kernel module inside Linux (macOS personality for arm64 Linux)
- License
- Mixed: GPL-2.0-only (Linux side), APSL-2.0 (XNU side)
- Try it
scripts/vm-xnu-build.sh, then scripts/xnulinux-boot.sh (see README)
A new GitHub project, AFK-surf/xnulinux, runs macOS userspace on Linux by loading Apple's own kernel into it. The repo builds XNU (the kernel at the heart of macOS) from the source code Apple publishes and loads it as a module, xnu.ko, into an unmodified arm64 Linux kernel. macOS and Linux processes then run side by side on the same CPUs, with no hypervisor between them. The README says it is "Copyright © 2026 Heyang Zhou and contributors."
It took off fast. Trendshift recorded about 2,400 stars in three days: roughly 1,900 on November 23 and 500 more on November 24. LavX News covered it on November 23. (The GitHub page we read showed a far lower count, which looked like a stale snapshot, so we're using Trendshift's figure.)
Why it's interesting: projects like Darling translate macOS system calls into Linux ones, and VMs run a whole second kernel behind a hypervisor. xnulinux does neither. It runs the real macOS kernel as a guest inside the Linux kernel.
How it works
According to the README, the project is split into two kernel modules:
| Piece | License | Role |
|---|---|---|
xnu.ko |
APSL-2.0 | Loads and runs the XNU kernel collection |
fki.ko ("foreign kernel interface") |
GPL-2.0-only | Gives XNU its CPUs, memory, page faults, inter-CPU interrupts, files, network and host calls |
kexts/ |
APSL / BSD-2-Clause-Patent | Drivers for a disk (a file on the Linux side), framebuffer display, keyboard/pointer, Ethernet, keystore and GPU bridge |
Each macOS CPU is a Linux kernel thread pinned to one Linux CPU. XNU gets one contiguous block of memory, carved out by Linux's CMA allocator, and manages it with its own page tables. For graphics, Metal calls are translated to Vulkan (a "metal2vulkan" layer) and reach the host GPU through Mesa's Venus driver. Without a GPU, it falls back to Mesa's lavapipe software renderer.
Because xnu.ko isn't GPL, Linux marks it as a proprietary module and the kernel gets "tainted". The README compares this to ZFS.
What the author says works
These are the project's own results. We haven't seen any independent tests.
- macOS 27.2.1 boots to the desktop with auto-login in 31–48 seconds. The README compares this with 49 seconds for an Apple Virtualization macOS VM on the same Mac.
- Apps open and quit, and Spotlight and the file system work. Screenshots show the login window, WindowServer, Dock, Finder and Safari.
- A 30-minute stress run of 40 rounds finished with no kernel panic and no crash report.
- It can run as a systemd service (
xnulinux.service).
Requirements and catches
- An arm64 Linux host with pointer authentication (PAC), 4K pages and about 24 GB of RAM, 8 GB of it reserved for XNU. LavX gives 16 GB. We've gone with the README. The README describes running it in a Linux VM on an Apple Silicon (M1 or later) Mac, using krunkit (needed for GPU) or tart. It also refers to an Ubuntu host on Linux 7.0.
- A Mac with Xcode to build the system disk and GPU parts, and your own macOS 27 installation. The README says no Apple binaries are in the repo or distributed by it.
- Weakened macOS security. The README says the OS cryptex is merged into the system volume, AMFI (Apple Mobile File Integrity, which enforces code signing) is patched, and SIP (System Integrity Protection) is relaxed. Memory access is slower than in a native VM because XNU runs on 4K pages instead of its usual 16K.
- The GPU bridge is experimental. Per the README, it is off by default while the developers look into occasional whole-system hangs with it on. LavX describes it differently. Expect it to change.
- Licensing and Apple's terms are your problem. The repo ships only source code. Running macOS on hardware other than Apple's is a separate question for anyone thinking of using this in production. The project says it isn't affiliated with or endorsed by Apple.
Try it
The README describes a script-driven setup:
# inside the arm64 Linux VM
scripts/vm-xnu-build.sh # once
scripts/vm-xnu-rebuild.sh
# on the Mac: build the macOS system disk
scripts/mk-macvm-disk.sh
# back in the Linux VM
scripts/xnulinux-boot.sh # console: scripts/xnu-console.sh
Who should care: kernel and virtualization developers, and anyone curious how far kernel-in-kernel hosting can go. It isn't a practical way to run Mac apps on a Linux PC: you still need a Mac to set it up, and the security changes it requires mean it shouldn't be trusted with real data. Things to watch: independent reproductions, especially on non-Apple arm64 hardware, and whether the GPU bridge becomes stable.
Sources
- GitHub — AFK-surf/xnulinux github.com
- LavX News — xnulinux Loads macOS Kernel Into Linux on Apple Silicon news.lavx.hu
- Trendshift — AFK-surf/xnulinux trendshift.io