Running GNU Hurd userspace on Apple's XNU kernel
This project ports GNU Hurd's microkernel-based userspace to run on Apple's XNU kernel, combining:
- XNU: Apple's hybrid kernel (Mach + BSD) with modern hardware support
- Hurd: GNU's microkernel OS with translator-based architecture
| Server | Status | Description |
|---|---|---|
| auth | β Working | Authentication with root handle |
| proc | β Working | Process management, PID/task conversion |
| exec | β Working | ELF execution (stubbed) |
| pfinet | β Working | Network (BSD socket wrapper) |
| ext2fs | β Working | Filesystem (POSIX wrapper) |
| Translator | Status | Description |
|---|---|---|
| term | β Working | PTY + console (/dev/ttys*) |
| symlink | β Working | Symbolic links |
| devnull | β Working | /dev/null, zero, full, random, urandom |
| tmpfs | β Working | In-memory filesystem (64MB) |
| Component | Status | Description |
|---|---|---|
| startup | β Working | Essential task registration, shutdown notify |
| init | β Working | Runlevel 0-3, service ordering |
| bootstrap | β Working | Server startup management |
| Component | Status | Description |
|---|---|---|
| rumpuser | β Working | NetBSD Rump hypercalls for XNU |
| machdev | β Working | Mach device layer compatibility |
| rumpdisk | β Working | Block devices (wd0, wd1) |
| rumpnet | β Working | Network interfaces (eth0, lo0) |
| LKL bridge | β Working | Linux Kernel Library integration |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
TEST SUMMARY
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Passed: 27
Failed: 0
Total: 27
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π ALL USERSPACE TESTS PASSED!
- macOS (tested on Sequoia 15.x, M4 Mac)
- Xcode Command Line Tools
- QEMU (optional, for boot testing)
# Clone
git clone --recursive https://github.com/J-x-Z/hurd-xnu
cd hurd-xnu
# Build all tests
make tests
# Run userspace integration test (27 tests)
./tests/userspace_test
# Run individual translator tests
./compat/term_test
./compat/tmpfs_test
./compat/devnull_testβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Hurd Userspace Tests β
β (shell, coreutils, network, multi-user, PTY) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Translators β
β term β symlink β devnull β tmpfs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Core Servers β
β auth β proc β exec β pfinet β ext2fs β startup β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Bootstrap / Init β
β hurd_bootstrap.c β init_xnu.c β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Driver Layer β
β rumpuser β machdev β LKL bridge β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Compatibility Layer β
β libports β MIG stubs β mach.h β ports.h β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β XNU Kernel β
β (Mach microkernel + BSD + IOKit) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
hurd-xnu/
βββ compat/ # XNU compatibility layer (~6000 lines)
β βββ auth_xnu.c # Auth server
β βββ proc_xnu.c # Proc server
β βββ exec_xnu.c # Exec server
β βββ pfinet_xnu.c # Network server
β βββ ext2fs_xnu.c # Filesystem translator
β βββ startup_xnu.c # Startup server
β βββ init_xnu.c # Init process
β βββ hurd_bootstrap.c # Bootstrap manager
β βββ term_xnu.c # Terminal translator
β βββ symlink_xnu.c # Symlink translator
β βββ devnull_xnu.c # /dev/null, zero, random
β βββ tmpfs_xnu.c # In-memory filesystem
β βββ rumpuser_xnu.c # Rump hypercalls
β βββ machdev_xnu.c # Mach device layer
β βββ lkl_hurd_bridge.c # LKL integration
β βββ mach.h # Mach type definitions
β βββ ports.h # libports interface
β βββ hurd/ # MIG .defs files
βββ tests/ # Test programs
β βββ hurd_userspace_test.c # Integration test (27 tests)
β βββ rump_integration_test.c
βββ hurd/ # Original Hurd source (submodule)
βββ xnu/ # XNU kernel source (submodule)
βββ qemu/ # QEMU boot infrastructure
- Phase 1-5: Environment, Mach IPC, libports, QEMU boot β
- Phase 6: Core Hurd servers (auth, proc, exec, pfinet, ext2fs) β
- Phase 7: Rump Kernels (rumpdisk, rumpnet) β
- Phase 8: Bootstrap + Startup + Init β
- Phase 9: Translators (term, symlink, devnull, tmpfs) β
- Phase 10: Userspace integration (27/27 tests) β
- Phase 11: Bare metal Hurd on XNU (launchd, Kext, boot image)
| Category | Files | Lines |
|---|---|---|
| Core Servers | 6 | ~1,400 |
| Translators | 4 | ~950 |
| Bootstrap/Init | 3 | ~720 |
| Driver Layer | 5 | ~1,600 |
| Compatibility | 10+ | ~1,500 |
| Tests | 5+ | ~800 |
| Total | 30+ | ~7,000 |
- Hurd components: GPL-2.0
- XNU: APSL-2.0
- This compatibility layer: GPL-2.0
This is an experimental research project. Contributions welcome!
- Fork this repository
- Create a feature branch
- Submit a Pull Request
- GNU Hurd developers
- Apple XNU team (open source kernel)
- OSX-KVM / DarwinKVM communities
- NetBSD Rump and LKL projects