SwiftOS is a real operating system entirely written in Swift, running a bare-metal aarch64 kernel with a Linux-like GUI desktop on QEMU virt (Pi 5 profile).

Stars

84

7-day growth

0

Forks

1

Open issues

0

License

No data

Last updated

2026-07-18

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It demonstrates the feasibility of building a complete OS kernel and userland from scratch using only Swift, without any Apple frameworks or Linux, including SMP, a custom filesystem, networking stack, and a full GUI desktop environment.

Who it is for

  • OS developers interested in Swift-based kernels
  • Swift enthusiasts exploring systems programming
  • Embedded systems learners looking for a hands-on project
  • Hobbyists wanting a self-contained OS learning platform

Use cases

  • Learning OS kernel development with Swift
  • Experimenting with custom filesystems and scheduling
  • Building a simple GUI desktop environment for educational purposes
  • Testing bare-metal networking and device drivers

Strengths

  • Entirely custom Swift code from boot to GUI, no external dependencies
  • Real SMP with preemptive scheduling across 4 cores
  • Persistent filesystem (SwiftFS) with metadata journaling
  • Full networking stack including ARP/IPv4/ICMP/UDP and DNS resolution

Considerations

  • Currently only targets QEMU virt (Pi 5 profile); real hardware not supported
  • Userland and drivers run on cpu0 only; EL0 user processes and cross-core TLB shootdown are future work
  • Unicode support limited to ASCII; no TCP yet

README quick start

SwiftOS

A real operating system written entirely in Swift — a bare-metal aarch64 kernel (Embedded Swift, no stdlib runtime) with a Linux-feel GUI desktop running on top. Boots on QEMU's virt machine configured to match a Raspberry Pi 5 (8 GB): Cortex-A76, 4 cores, 8 GiB RAM. No Linux, and in the kernel/userland no Apple frameworks at all: every driver, the scheduler, the filesystem, the window manager, the shell, and the renderer are our own Swift.

SwiftOS kernel 1.0.0-aarch64 (Embedded Swift, bare metal)
[boot] exception level EL1
[boot] heap 248 MB
[boot] heap self-test ok
[mmu] identity map on, caches enabled
[gic] timer irq 30 at 100 Hz
[fb] ramfb 1280x800 @ 0x0000000044804000
[blk] virtio-blk (slot 29): 65536 sectors (32 MiB)
[disk] persistent storage online
[sched] scheduler up: main + idle + kworker, quantum 50 ms
[input] virtio tablet (slot 30)
[input] virtio keyboard (slot 31)
[boot] login session started — compositor running

Features

Kernel

  • Device-tree machine discovery (FDT parser): RAM size, CPUs, GIC, UART, fw_cfg, virtio-mmio slots, PSCI method — no hardcoded platform addresses
  • Boot at EL2→EL1, FP/SIMD bring-up on all 4 cores, PL011 UART console
  • Real SMP: all 4 cores schedule threads off a global run queue (baton-locked context switch, per-core 100 Hz ticks and idles, cross-core kill/reap, Linux-style %CPU — smpdemo 3 shows ~300% across cores)
  • Panic broadcast: any core's panic halts the others via IPI
  • MMU + caches identity-mapping the full 8 GiB, 1 GiB kernel heap
  • MMU + caches (identity map), page-bitmap physical allocator + boundary-tag heap backing the Swift runtime's posix_memalign/free
  • GICv2 + ARM generic timer (100 Hz tick), full exception vector table
  • Preemptive round-robin kernel threads (50 ms quantum, context switch in the timer IRQ) with real per-thread CPU accounting
  • Scheduled EL0 user processes (urun): real user-mode threads with per-process L2/L3 page tables, SVC syscall ABI, preemption and migration across cores (per-core page-table pairs + switch-time TLB flush), containment on faults, kill/reap with full teardown
  • virtio-blk storage + SwiftFS, our own filesystem — now with a metadata journal (sector-level redo log, mount-time replay): verified consistent after SIGKILL mid-write, three cycles
  • Networking: virtio-net

Related repositories

Similar projects matched by category, topics, and programming language.

Blaizzy
Featured
Blaizzy GitHub avatar

nativ

Nativ is a native macOS app that lets you run AI models locally on Apple silicon, offering chat, model management, performance analytics, and an OpenAI/Anthropic-compatible API server.

AI & Machine LearningAI Vision & Audio
985
uzairansaruzi
Featured
uzairansaruzi GitHub avatar

hermex

Hermex is a native SwiftUI iPhone app that lets you control a self-hosted Hermes AI agent directly from your phone, with no subscriptions, tracking, or third-party relay.

AI & Machine LearningLarge Language Models
941
simonw
Featured
simonw GitHub avatar

speech-analyzer-cli

A macOS command-line tool that uses Apple's on-device speech APIs to transcribe prerecorded audio into plain text, JSON, JSONL, SRT, or WebVTT.

Developer ToolsCLI & Terminal
20