A small Unix-like operating system for x86_64, written in mach: the kernel, the boot loader and the userland.
- Kernel: every CPU core (SMP), preemptive multitasking, processes and threads (futexes), signals, pipes,
mmap, readiness queues,/proc,/dev/events - Boot:
machboot, its own UEFI boot loader (also written in mach), dual boot with Windows, a live ISO that runs from memory and can install itself, and an updater - Storage: AHCI and NVMe disks, GPT, ext2 (the root), FAT32 and exFAT (USB sticks, the EFI partition),
fsck - Devices: xHCI USB with hubs and hotplug, PS/2 and USB keyboards, framebuffer and serial consoles, RTC with time zones
- Userland: over eighty programs, most of them on mach's std: a shell with job control and line editing,
nano,less,tar,gzip,grep,sort,top, and so on.ls /binlists them
tools/run.sh # build a disk image and boot it in QEMU
Log in as root (no password).
You need the mach compiler (6.10) and, on Arch:
sudo pacman -S lld gptfdisk e2fsprogs mtools xorriso qemu-system-x86 edk2-ovmf python
tools/run.sh # build a disk image and boot it in QEMU
tools/run.sh release # the same, optimized
tools/run.sh --fresh # start from a new disk
tools/iso.sh # build the live ISO (out/machos.iso)
tools/test.py # run all the tests
tools/test.py wget tcp # run only the named tests
The ISO is UEFI: it boots from a CD, from a USB stick (dd it there) or from Ventoy. Inside, install puts MachOS on a disk.
tools/test.py boots MachOS in QEMU and drives it over the serial console: boot, shell, USB, boot loader menus, dual boot, install, update, filesystems, fsck and rescue, the network (a host-side UDP echo and web server stand in for the internet), and std's own test suite. Tests that need the internet, such as dns, say so in the test table.
tools/gdb.sh # boot paused, with a gdb stub on :1234
tools/mount.sh # mount the dev disk on the host, without sudo
tools/put.sh FILE # copy a file onto the disk image
tools/boot.sh IMAGE|/dev/sdX # boot an existing install as it is
| Directory | What is in it |
|---|---|
kernel/ |
the kernel: arch, mm, kern (processes, system calls), fs, dev, net, boot |
machboot/ |
the UEFI boot loader |
sdk/ |
MachOS's own system-call layer and runtime, for the programs that need it |
userland/ |
the programs (src/bin) and their shared code (src/lib); mach.toml is generated by tools/programs.sh |
root/ |
files copied onto the root filesystem: /etc, the motd |
examples/ |
hello, posixtest and stdtest, which run std's tests on MachOS |
tools/ |
build, run, test and image scripts |
MachOS is a hobby system. It runs on QEMU and boots from USB sticks and disks, but expect rough edges.
MachOS is licensed under GNU General Public License, version 3 only. Third-party components retain their respective licences.
