Technical design
How SwiftVM is built.
flowchart LR
CLI["swiftvm<br/>command-line tool"] <-->|"Unix socket"| APP["SwiftVM app<br/>menu bar · windows · SwiftVMKit"]
APP <-->|"Virtualization framework"| GUEST["Guest<br/>macOS or Linux"]
APP <-->|"socket device"| AGENT["Guest agent<br/>inside the guest"]
APP <-->|"vmnet"| NETWORK["Shared network"]
GUEST <--> NETWORK
The big ideas:
- Machines run inside the app. Apple's Virtualization framework runs each guest in the app's own process. There is no helper, no kernel extension, and nothing runs as root.
- A machine is a folder. Its settings, disk, firmware, and snapshots live
in one
.swiftvmpackage. Copies and snapshots are APFS clones of its files. - The app owns the machines; the command line drives the app.
swiftvmis a thin client of the running app, so the panel and the terminal can never disagree. - The guest agent needs no network. It talks to the app over the
machine's socket device, so the clock, shutdown, and clipboard work when
the guest's network is down. So does everything
swiftvmdoes inside a guest: commands, the screen, the mouse, and the keyboard. - The engine is separate from the interface. Everything that isn't
interface is in the
SwiftVMKitpackage, behind a backend protocol that a second engine can implement.
Read next#
- Architecture: programs, modules, and what happens when a machine starts.
- Decisions: the key choices and what was turned down.
- Constraints: supported platforms and hard-won lessons.
- Building: building, signing, and the development copy.
- Releasing: how a release is made and how updates reach people.