HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
apple
darwin-xnu
C2017–2026
apple / darwin-xnu · Archived

darwin-xnu

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

60Distinct people
66Mentions
0Explicit recommenders
11.3KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

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

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year66 dated mentions

Observed mentions: 2017-09-30 03:48:44 UTC to 2026-05-02 14:02:37 UTC.

0510152017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 9 mentions; 2 submissions, 7 comments20172018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 10 mentions; 0 submissions, 10 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 14 mentions; 1 submissions, 13 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 14 mentions; 0 submissions, 14 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC927
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC808
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC505
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC10010
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC14113
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC14014
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC303
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC000
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC000
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
What is XNU? XNU kernel is part of the Darwin operating system for use in macOS and iOS operating systems. XNU is an acronym for X is Not Unix. XNU is a hybrid kernel combining the Mach kernel developed at Carnegie Mellon University with components from FreeBSD and a C++ API for writing drivers called IOKit. XNU runs on x86_64 for both single processor and multi-processor configurations. XNU Source Tree config - configurations for exported apis for supported architecture and platform SETUP - Basic set of tools used for configuring the kernel, versioning and kextsymbol management. EXTERNAL_HEADERS - Headers sourced from other projects to avoid dependency cycles when building. These headers should be regularly synced when source is updated. libkern - C++ IOKit library code for handling of drivers and kexts. libsa - kernel bootstrap code for startup libsyscall - syscall library interface for userspace programs libkdd - source for user library for parsing kernel data like kernel chunked data. makedefs - top level rules and defines for kernel build. osfmk - Mach kernel based subsystems pexpert - Platform specific code like interrupt handling, atomics etc. security - Mandatory Access Check policy interfaces and related implementation. bsd - BSD subsystems code tools - A set of utilities for testing, debugging and profiling kernel. How to build XNU Building DEVELOPMENT kernel The xnu make system can build kernel based on KERNEL_CONFIGS & ARCH_CONFIGS variables as arguments. Here is the syntax: make SDKROOT=<sdkroot> ARCH_CONFIGS=<arch> KERNEL_CONFIGS=<variant> Where: <sdkroot>: path to macOS SDK on disk. (defaults to /) <variant>: can be debug, development, release, profile and configures compilation flags and asserts throughout kernel code. <arch> : can be valid arch to build for. (E.g. X86_64) To build a kernel for the same architecture as running OS, just type $ make $ make SDKROOT=macosx.internal Additionally, there is support for configuring architectures through ARCH_CONFIGS and kernel configurations with KERNEL_CONFIGS. $ make SDKROOT=macosx.internal ARCH_CONFIGS=X86_64 KERNEL_CONFIGS=DEVELOPMENT $ make SDKROOT=macosx.internal ARCH_CONFIGS=X86_64 KERNEL_CONFIGS="RELEASE DEVELOPMENT DEBUG" Note: By default, architecture is set to the build machine architecture, and the default kernel config is set to build for DEVELOPMENT. This will also create a bootable image, kernel.[config], and a kernel binary with symbols, kernel.[config].unstripped. To intall the kernel into a DSTROOT, use the install_kernels target: $ make install_kernels DSTROOT=/tmp/xnu-dst Hint: For a more satisfying kernel debugging experience, with access to all local variables and arguments, but without all the extra check of the DEBUG kernel, add something like: CFLAGS_DEVELOPMENTARM64="-O0 -g -DKERNEL_STACK_MULTIPLIER=2" CXXFLAGS_DEVELOPMENTARM64="-O0 -g -DKERNEL_STACK_MULTIPLIER=2" to your make command. Replace DEVELOPMENT and ARM64 with the appropriate build and platform. To build with RELEASE kernel configuration make KERNEL_CONFIGS=RELEASE SDKROOT=/path/to/SDK Building FAT kernel binary Define architectures in your environment or when running a make command. $ make ARCH_CONFIGS="X86_64" exporthdrs all Other makefile options $ make MAKEJOBS=-j8 # this will use 8 processes during the build. The default is 2x the number of active CPUS. $ make -j8 # the standard command-line option is also accepted $ make -w # trace recursive make invocations. Useful in combination with VERBOSE=YES $ make BUILD_LTO=0 # build without LLVM Link Time Optimization $ make REMOTEBUILD=user@remotehost # perform build on remote host $ make BUILD_JSON_COMPILATION_DATABASE=1 # Build Clang JSON Compilation Database The XNU build system can optionally output color-formatted build output. To enable this, you can either set the XNU_LOGCOLORS environment variable to y, or you can pass LOGCOLORS=y to the make command. Debug information formats By default, a DWARF debug information repository is created during the install phase; this is a "bundle" named kernel.development.<variant>.dSYM To select the older STABS debug information format (where debug information is embedded in the kernel.development.unstripped image), set the BUILD_STABS environment variable. $ export BUILD_STABS=1 $ make Building KernelCaches To test the xnu kernel, you need to build a kernelcache that links the kexts and kernel together into a single bootable image. To build a kernelcache you can use the following mechanisms: Using automatic kernelcache generation with kextd. The kextd daemon keeps watching for changing in /System/Library/Extensions directory. So you can setup new kernel as $ cp BUILD/obj/DEVELOPMENT/X86_64/kernel.development /System/Library/Kernels/ $ touch /System/Library/Extensions $ ps -e | grep kextd Manually invoking kextcache to build new kernelcache. $ kextcache -q -z -a x86_64 -l -n -c /var/tmp/kernelcache.test -K /var/tmp/kernel.test /System/Library/Extensions Running KernelCache on Target machine The development kernel and iBoot supports configuring boot arguments so that we can safely boot into test kernel and, if things go wrong, safely fall back to previously used kernelcache. Following are the steps to get such a setup: Create kernel cache using the kextcache command as /kernelcache.test Copy exiting boot configurations to alternate file $ cp /Library/Preferences/SystemConfiguration/com.apple.Boot.plist /next_boot.plist Update the kernelcache and boot-args for your setup $ plutil -insert "Kernel Cache" -string "kernelcache.test" /next_boot.plist $ plutil -replace "Kernel Flags" -string "debug=0x144 -v kernelsuffix=test " /next_boot.plist Copy the new config to /Library/Preferences/SystemConfiguration/ $ cp /next_boot.plist /Library/Preferences/SystemConfiguration/boot.plist Bless the volume with new configs. $ sudo -n bless --mount / --setBoot --nextonly --options "config=boot" T
Read the full README on GitHub

What Hacker News says

66 sources
The linked to blog post in the OP explains this better IMHO [0]: If the data stream encodes values with byte order B, then the algorithm to decode the value on computer with byte order C should be about B, not about the relationship between B and C. One cannot just ignore the big/little data interchange problem MacOS[1], Java, TCP/IP, Jpeg etc... The point (for me) is not that your code runs on a s390, it is that you abstract your personal local implementation details from the data interchange formats. And unfortunately almost all of the processors are little, and many of the popular and unavoidable externalization are big... [0] https://commandcenter.blogspot.com/2012/04/byte-order-fallac... [1] https://github.com/apple/darwin-xnu/blob/main/EXTERNAL_HEADE...
In Big-Endian Testing with QEMU
Yeah, I probably went too far in saying it's just the userland, but I'll insist it's more complicated than saying it was based on 4.4BSD-Lite2. I haven't done a proper deep dive yet, but I can tell that it wasn't strictly based on the Lite2 release. Take a look at XNU 123.5's (OS X 10.0) kern/tty.c: https://github.com/apple/darwin-xnu/blob/xnu-123.5/bsd/kern/... Notice the SCCS version info dates the file 1/21/94. Now look at the Lite2 equivalent: https://github.com/sergev/4.4BSD-Lite2/blob/master/usr/src/s... The SCCS date on this file is 1/9/95, a year later. It appears the XNU copy is from Lite1 instead: https://github.com/dspinellis/unix-history-repo/blob/BSD-4_4... You'll also see the source has been reorganized, with e.g. the VFS source being regrouped into bsd/vfs, instead of being left in bsd/kern. This coincidentally mirrors how
Read the rest
OSF/1 was organized (no other source relation though, just an interesting observation): https://github.com/Arquivotheca/OSF1/tree/OSC200/src/kernel/... For that matter, compare the the differences between vfs_bio.c in XNU: https://github.com/apple-oss-distributions/xnu/blob/rel/xnu-... With Lite2's, where most function bodies have been replaced with the comment "Body deleted.", presumably due to use of encumbered code: https://github.com/sergev/4.4BSD-Lite2/blob/master/usr/src/s... This file had to be reimplemented by all of the BSDs. In this case, this version appears distinct from the FreeBSD and NetBSD versions I can find. If you grep around for the `NeXT` ifndef/ifdefs in XNU, too, you'll see some code of which some appears to have been copied/adapted from the NeXT source tree, itself derived from Mach/CMU sources. (and 4.3BSD ;-) I say all this to draw attention to the ways XNU differs from BSD, which is pretty interesting, at least to me.
In Linuxulator on FreeBSD Feels Like Magic
Xnu is based on Mach 3, only the older NeXT/OpenStep kernels were based on a mix of Mach 2.0 and 2.5. MacOS uses a BSD personality colocated in the same address space as the Mach part, so it is no pure microkernel system. You can check the last (OpenStep-based) Rhapsody kernel sources from Darwin 0.3 at https://github.com/evolver56k/Darwin-0.3/tree/master/kernel-... and the first archived version of the MacOS X xnu kernel at https://github.com/apple/darwin-xnu/tree/xnu-123.5/osfmk
In OS/2 Warp, PowerPC Edition
You use unfree Linux too...for example google. What people seam to forget, under GPL you don't need to give your code back if your DON'T redistribute it. And that's why google forbids the use of AGPL internally. >You mean macOS? https://github.com/apple/darwin-xnu Why dont you know that? If your a apple user and so interested in opensource?
In FreeBSD, Linux, and I
macOS is a UNIX, but it's not Linux. It doesn't use X11 or Wayland, any more than Android does. If you removed Quartz, there would be no GUI left. If that's what you want, then there is Darwin out there. https://github.com/apple/darwin-xnu There have been various efforts to make it run as a standalone OS with X11: • Pure Darwin: http://www.puredarwin.org/ • Open Darwin: https://archiveos.org/opendarwin/ • Next BSD: https://github.com/NextBSD/NextBSD But they aren't much use. If you just want tiling windows, then I use Rectangle: https://rectangleapp.com/ For me that replaced Spectacle when that was discontinued: https://www.spectacleapp.com/
In BSD-XFCE installs macOS-like XFCE enviroment on FreeBSD
Have you looked at `__ulock_wake` versus `os_unfair_lock_with_options`? __ulock_wake is another private darwin API for locking. From some Zig code: // Darwin XNU 7195.50.7.100.1 introduced __ulock_wait2 and migrated code paths (notably pthread_cond_t) towards it: // https://github.com/apple/darwin-xnu/commit/d4061fb0260b3ed486147341b72468f836ed6c8… // // This XNU version appears to correspond to 11.0.1: // https://kernelshaman.blogspot.com/2021/01/building-xnu-for-macos-big-sur-1101.html // // ulock_wait() uses 32-bit micro-second timeouts where 0 = INFINITE or no-timeout // ulock_wait2() uses 64-bit nano-second timeouts (with the same convention)
In Improving Firefox Responsiveness on macOS

Showing the 15 most recent of 66 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.