XNU Linux Offers a New Way to Run macOS Applications on Linux

An experimental project runs the genuine macOS kernel inside Linux, supporting Finder, Dock, Safari, and other native macOS applications.

An experimental project called XNU Linux demonstrates a rather unusual approach to running macOS on Linux. Instead of depending on traditional virtualization or recreating Apple’s system interfaces, it loads the actual macOS kernel as a Linux kernel module, allowing macOS applications to execute alongside native Linux processes.

Developed by Heyang Zhou, one of the creators of Deno Deploy, the project builds Apple’s open-source XNU kernel from its source code and packages it as a loadable module named xnu.ko. Once loaded into an ARM64 Linux kernel, XNU can directly access the CPU and memory management unit. This enables both operating systems to share the same processors without a hypervisor separating them.

The implementation relies on a second Linux kernel module, fki.ko, which provides a Foreign Kernel Interface. Through it, XNU receives access to memory, timers, file operations, networking, and other resources managed by Linux. Each hosted XNU CPU runs as a Linux kernel thread pinned to a host CPU, while Linux handles the underlying hardware and forwards relevant exceptions to XNU.

xnulinux

To support the macOS environment, the project also provides kernel extensions for storage, display output, keyboard and mouse input, Ethernet networking, and graphics. The storage implementation uses a disk image stored on the Linux side, while the graphics subsystem translates Apple’s Metal API to Vulkan and can access the host GPU through Mesa’s Venus driver.

According to the project’s documentation, the developer has successfully booted macOS 27.2.1 to a working desktop using a standard Ubuntu Linux kernel. The demonstrated environment includes loginwindow, WindowServer, Dock, Finder, Safari, and Chrome, along with functioning Spotlight search and file system access.

However, as you can expect, there are some considerable limitations. Currently, XNU Linux requires an ARM64 Linux environment with pointer authentication support, specifically an Apple Silicon Mac with an M1 processor or newer. The documented setup runs Linux inside a virtual machine using krunkit or Tart. This means virtualization is still involved in hosting Linux, although no additional hypervisor separates Linux from the loaded XNU kernel.

Moreover, the project requires at least 16 GB of RAM, with 8 GB reserved for the hosted macOS kernel, along with a separate macOS installation created using Apple’s installer. No proprietary Apple binaries are distributed through the repository.

For now, the project continues as a technical experiment rather than a workable solution for running macOS applications on conventional Linux PCs. The source code, build scripts, and technical documentation are available on the project’s GitHub repository.

Image credits: xnulinux

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Leave a Reply

Your email address will not be published. Required fields are marked *