XNU Linux Runs a macOS Desktop Inside a Linux Kernel
Running a macOS desktop on a Linux machine normally suggests a virtual machine. xnulinux takes a stranger route: it builds Apple’s open-source XNU kernel into a loadable module, starts it inside an arm64 Linux kernel, and lets XNU run macOS processes alongside Linux processes. The project reports a working desktop with loginwindow, WindowServer, Dock, Finder, Safari, and other applications. Linux remains the host that supplies memory and devices.
That description needs a careful boundary. This is not a Linux implementation of macOS system calls, and it does not make an arbitrary Linux desktop run Mac applications. The guest processes execute under a real, modified XNU kernel and use a macOS system installation supplied by the person building the project. The unusual part is where that kernel lives: inside Linux rather than inside a separate virtual machine.
Two operating systems share the CPUs
In a conventional VM, a hypervisor presents virtual hardware to a guest kernel. Here, Linux first loads fki.ko, a host-facing module, then xnu.ko, which loads and runs the XNU kernel collection. Each hosted XNU CPU is a Linux kernel thread pinned to a Linux CPU. XNU runs until it needs a service from its host, such as I/O, a timer, or an idle transition. The Foreign Kernel Interface (FKI) supplies a deliberately narrow set of calls between the two sides.
The distinction between running on the same machine and having the same kernel matters. A macOS process uses XNU’s Mach, BSD, and driver interfaces. A Linux process uses Linux. The two user spaces share physical CPUs and the Linux host’s resources, but they do not become one interchangeable application environment. XNU manages its own address space and page mappings within memory allocated by Linux. Linux retains its exception vectors; the interface module forwards faults and user exceptions from hosted XNU execution to XNU’s handlers.
The project assigns XNU a contiguous physical memory carve-out through Linux’s contiguous memory allocator. Both sides use a compatible 4 KiB hardware page granule, a significant constraint for an arm64 port. XNU then builds its own virtual-memory mappings over that allocation. This is why the result is more than launching a desktop shell: the macOS process sees the kernel behavior its binaries expect, while Linux continues to own the underlying machine.
Devices are bridges, not emulated magic
A desktop needs storage, input, display, networking, and a way to draw windows. xnulinux provides XNU kernel extensions for these functions. A disk extension exposes a Linux-side file as the hosted system disk. Display and input extensions connect a framebuffer, keyboard, and pointer to host tools. An Ethernet extension connects the hosted network to a Linux interface. The project also includes a keystore and a graphics bridge.
That device split is a practical design choice. Instead of porting every native Mac driver to every Linux device, the hosted XNU sees a small set of devices built for this environment. Linux handles the actual file, network, and GPU resources. The arrangement also explains why preparing the macOS disk is a substantial part of setup: the repository does not distribute Apple’s system image or bundled binaries. The builder must start with their own macOS installation and use the project scripts to prepare its kernel collection and disk.
Graphics has two paths. The fallback uses a Metal plugin that translates through Vulkan to Mesa’s software renderer, lavapipe. This draws on the CPU. Where a supported virtio-gpu render node is available, the plugin can use Mesa’s Venus driver and cross a DRM bridge to the Linux host GPU. A hosted application sends graphics operations through an XNU user client, FKI, and the xnudrmd host service to the Linux render node. The project reports this hardware path working in its Apple Silicon Linux VM setup. Its bare-metal NVIDIA DGX Spark setup currently uses CPU rendering because the DRM forwarding service supports the virtio-gpu path, not the GB10 GPU’s native driver interface.
What has been demonstrated
The project’s current README describes two tested arm64 environments. One runs Linux in a VM on Apple Silicon, then runs hosted XNU inside that Linux kernel. The other runs Linux directly on an NVIDIA DGX Spark. On the Apple Silicon setup, the project reports macOS 27.2.1 reaching the desktop with automatic login in 31–48 seconds across runs with one to six hosted CPUs. It compares that with 49 seconds for an Apple Virtualization macOS VM on the same Mac. This is a project-specific boot comparison, not a general claim that hosted XNU outperforms virtualization.
The authors also report a 30-minute run that repeatedly opened and closed Safari, Notes, Calculator, TextEdit, System Settings, and Spotlight, plus a disk walk, without a panic or crash report. A systemd service can start the hosted kernel at Linux boot, record logs, and restart after a hosted-kernel panic. On DGX Spark, the reported configuration reserves 8 GiB for XNU, uses four hosted CPUs, reaches the full desktop, and exposes Screen Sharing and SSH. Those results show a real, interactive system, while remaining the project’s own tests on a small number of machines.
The production notes show why a working desktop is not the end of the engineering. The system volume and OS cryptex are combined for this boot path; application security and system integrity settings are relaxed or patched. Some hardware-specific daemons need substitutes or must be disabled. Memory-bound work still suffers from the host’s 4 KiB translation granule compared with native 16 KiB Apple Silicon operation. GPU buffer and IOSurface copies remain an optimization target. A loaded non-GPL xnu.ko also taints the Linux kernel, a support and debugging consideration.
Why the build is demanding
The host must be arm64, support pointer authentication, use 4 KiB pages, and have enough memory for the Linux side and an XNU carve-out. The README calls for at least 16 GiB total, with 8 GiB reserved for hosted XNU. A Mac with Xcode is needed to prepare the system disk and build graphics components, and the builder needs a macOS 27 installation of their own.
The build sequence creates an arm64 XNU toolchain, applies a Linux-hosted machine layer and other XNU patches, builds kernel extensions, links a kernel collection using components from the builder’s macOS installation, and prepares the system disk. A boot script then builds both Linux modules against the running host kernel, sets up networking and the available graphics path, and starts XNU. On bare metal, the memory carve-out must match the machine’s physical memory layout. These are operating-system development steps, not an installable desktop package.
The license boundary is explicit in the repository. The Linux-facing FKI code is GPL-2.0-only; the XNU loader and patches are APSL-2.0. xnu.ko communicates with Linux only through the FKI interface. This division affects the code structure and the resulting Linux module’s license declaration. It is also a reminder that “open-source XNU” does not mean the entire macOS installation is open source or included in this repository.
What this experiment changes
xnulinux demonstrates a different way to compose operating systems: one kernel hosts another as a module, while the hosted kernel provides its native application ABI and the host supplies hardware services. Its value is the boundary it makes visible. CPU scheduling, memory ownership, faults, storage, networking, graphics, and licensing each need a deliberate crossing between XNU and Linux. The desktop appears only after all of those crossings work together.
For now, the project is a technically ambitious proof of concept with narrow hardware and macOS-version requirements. The useful takeaway is not a universal Mac-app runtime for Linux. It is a working example of how much of an operating system can be hosted inside another kernel when the machine layer and device interfaces are rebuilt for that arrangement.