XNU is the hybrid kernel that powers macOS and iOS operating systems, combining the Mach kernel with FreeBSD components and the IOKit driver framework.
The kernel addresses the need for a unified operating system foundation across Apple's platforms by merging multiple kernel architectures into a single codebase. XNU runs on both x86_64 and ARM64 processors in single and multi-processor configurations. The source tree is organized into distinct subsystems: the Mach-based kernel components in osfmk, BSD subsystems, the C++ IOKit library for driver and kernel extension handling, platform-specific code in pexpert, security policy interfaces, and supporting libraries for syscalls, kernel bootstrap, and kernel data parsing. The build system supports multiple kernel configurations and variants, allowing developers to compile debug, development, release, and profile versions tailored to specific architectures and use cases.
Adopting this repository is relevant only for developers working directly on macOS or iOS kernel development, kernel extensions, or low-level system debugging. It suits projects requiring deep platform integration or custom kernel modifications for these operating systems. The build system provides flexibility through configurable kernel variants and architecture targets, with support for additional compiler flags to enable selective debugging code. Developers can build kernels for their native architecture or cross-compile for different targets, and the system generates both stripped and unstripped binaries for debugging purposes.
The project maintains active synchronization of external headers to avoid dependency cycles during builds. The codebase includes comprehensive tooling for kernel testing, debugging, and profiling, reflecting ongoing development needs for kernel-level work. The build infrastructure supports multiple product configurations and allows fine-grained control over compilation through environment variables and command-line parameters.