Open source. Linked to the real code.
How macOS really works.
Every box is a real part of the kernel. Pan around, zoom in, and click a subsystem to dive from the whole system down to the source.
Grounded in the source.
Apple publishes the XNU kernel and most of Darwin as open source. Every claim on this site cites a file you can open in your browser.
Browse apple-oss-distributions on GitHubWhat is macOS internals?
macOS internals means the machinery under the Finder: the kernel, what launchd starts at boot, the dynamic linker, APFS, and the security layers that decide whether a binary gets to run at all. The open-source part is Darwin. Its kernel is XNU.
XNU is a hybrid, and the seams show. Mach owns tasks, threads, ports, the scheduler and virtual memory. The BSD layer bolted on top gives you processes, POSIX syscalls, signals, sockets and the VFS, which is why a process on macOS is both a BSD proc and a Mach task, with two different handles. IOKit, a restricted C++ framework, sits between drivers and the hardware. In user space, launchd is PID 1 and dyld loads every executable and its libraries, usually straight out of the shared cache.
Every explanation here links to the exact file and line in Apple's published source, because the docs stop long before the interesting parts.
Reading apple-oss-distributions/xnu
apple-oss-distributions/xnu is Apple's official GitHub mirror of the kernel source, with one tag per drop, such as xnu-12377.121.6. Most of your reading time goes into a handful of top-level directories:
- osfmk/
- Mach: tasks, threads, ports and IPC, the scheduler, and the machine-dependent VM and pmap code
- bsd/
- The BSD personality: processes, syscalls, signals, the VFS, sockets and the network stack
- iokit/
- The IOKit driver framework: IORegistry, IOService matching and power management
- libkern/
- Kernel C++ runtime, OSObject, atomics and kext support
- security/
- The MAC framework that the Sandbox and AMFI policies hook into
- san/
- Kernel sanitizers such as KASAN
- tests/
- Darwin tests that exercise kernel behavior from user space
git clone https://github.com/apple-oss-distributions/xnu, then git checkout the tag that matches your OS build. Two caveats. Source drops land some time after a macOS release, so the newest point release is often missing. And building a kernel you can actually boot needs the matching Kernel Debug Kit, so almost everyone reads XNU rather than builds it.