@openstrap/utm
v0.2.0
Published
OpenStrap UTM provider plugin
Readme
@openstrap/utm
UTM provider plugin for OpenStrap. Creates and drives the lifecycle of virtual machines on macOS.
Status
Working. provider-contract.live.ts creates an Ubuntu 24.04 machine on real UTM, boots it and reaches sshd through a forwarded port. The provider was written against what UTM does rather than what its dictionary declares — the dictionary is accurate about what exists and silent about three things that decide whether any of it works.
npm run test:liveNeeds UTM installed; downloads about 600 MB the first time. There is no fake provider and there will not be one.
What UTM actually supports
Verified by hand against UTM 4.7.5 (com.utmapp.UTM, direct download, sandboxed) on Apple Silicon. Full record: docs/wiki/grill/utm-scripting-probe.md in the openstrap repository.
The provider interface the milestone describes stands: disks, network and port forwarding are all configurable through scripting.
utmctlhas nocreate. Machines are created with the AppleScriptmakecommand.makeaccepts the whole scalar configuration in one call:name,architecture,memory,cpu cores,uefi,hypervisor.update configurationsets collections too — bothdrivesandnetwork interfaces.- Attaching a disk works. UTM imports the file into the
.utmpackage and converts it to qcow2. - Port forwarding works, in
mode: emulated. It does not exist inshared, which is the default aftermake.
Three constraints that only an experiment reveals
Enumerators do not resolve by name.
protocol:TCPfails with-1700; only the raw code works —«constant ****TcPp»for TCP,«constant ****UdPp»for UDP. JXA does not help. The provider must build AppleScript with raw constants taken fromUTM.sdef.The image file must live inside the UTM sandbox container. A source under
$HOMEor/private/tmpfails with "the file couldn't be opened because it doesn't exist" on a file that plainly exists. From~/Library/Containers/com.utmapp.UTM/Data/Documents/it attaches. The image cache therefore lives inside that container.No mutating command works while the application has no open window — scripting answers
UTM is not ready to accept commands (-2700)even though reads succeed.open -a UTMclears it.
qemu additional arguments is accepted silently and applied not at all, then errors on read. Nothing may be built on it — but nothing needs to be.
Consequences for the design
The guest is reached through a forwarded port on 127.0.0.1, so the endpoint is stable and openstrap reserves the host port itself. See ADR 0006 in the openstrap repository. No QEMU guest agent is required for access, so waiting means waiting for sshd, not for an agent.
