gitmyhub

darwin-xnu

C ★ 11k updated 3y ago ▣ archived

Legacy mirror of Darwin Kernel. Replaced by https://github.com/apple-oss-distributions/xnu

The source code for XNU, the hybrid kernel at the heart of macOS and iOS, combining the Mach microkernel, FreeBSD-derived subsystems, and the IOKit driver framework, published by Apple as part of the Darwin open-source project.

CC++Makesetup: hardcomplexity 5/5

This repository contains the source code for XNU, which is the kernel at the heart of macOS and iOS. A kernel is the lowest-level software running on a computer: it manages the processor, memory, storage, and all communication between hardware and the programs you run. Without the kernel, no application on your Mac or iPhone could function.

XNU stands for X is Not Unix, which is a reference to its hybrid nature. It combines two different foundations: the Mach microkernel, which was originally developed at Carnegie Mellon University, and code from FreeBSD, a Unix-like operating system. On top of those, it includes IOKit, a C++ framework used by hardware drivers. This layered architecture is why XNU is called a hybrid kernel rather than a pure implementation of either Mach or Unix.

The repository is organized into directories that correspond to these layers. The osfmk directory contains the Mach-based components. The bsd directory contains the BSD-derived subsystems. The libkern and iokit code supports hardware drivers. Other directories handle startup, system calls, platform-specific behavior, and security policies.

Building XNU requires Apple's development toolchain and macOS SDK. The build system uses make, and you can produce debug, development, or release variants of the kernel. The README includes instructions for loading a custom-built kernel on a test machine in a way that automatically falls back to the original kernel if something goes wrong during boot.

Apple publishes this source code as part of the Darwin open-source project. It reflects the kernel version shipping in Apple operating systems, though some components remain closed source and are not included here.

Where it fits