scripting: provision macOS guests on first boot - #7881
Merged
Merged
Conversation
osy
force-pushed
the
feature/apple-guest-provisioning
branch
from
September 19, 2026 15:46
bfe966c to
77aa6bc
Compare
macOS 27 can create the guest's user account, turn on automatic login and
Remote Login without going through Setup Assistant, which lets CI and other
automation get a ready-to-use macOS VM. The guest only reads these options
on the first boot after macOS is installed and they include a password, so
they are passed as a parameter to a single start and are never saved to the
configuration or the registry.
This is only exposed to AppleScript (`start ... provisioning {...}`) and
utmctl (`start --provision-*`) because most users will never need it. utmctl
can read the password from standard input to keep it out of the process
list. Requests that cannot be honoured (not a macOS guest, host older than
macOS 27, install still pending, saved state, recovery mode, invalid account)
fail before the VM starts so the first boot is not used up.
UTMScripting.swift has only the regenerated `start` declaration. The rest of
the current bridge-gen.sh output is unrelated to this change.
Assisted-by: Claude:claude-fable-5-1
osy
force-pushed
the
feature/apple-guest-provisioning
branch
from
September 20, 2026 03:26
77aa6bc to
602d8fc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macOS 27 can set up a macOS guest without Setup Assistant:
VZMacGuestProvisioningOptionscreates the user account and can turn on automatic login and Remote Login. This makes "create a ready-to-use macOS VM" possible for CI and other automation. The guest only reads these options on the first boot after macOS is installed.start vm provisioning {full name:"CI", username:"ci", password:"…", automatic login:true, remote login:true}utmctl start vm --provision-username ci --provision-password-stdin --provision-auto-login --provision-ssh(also--provision-passwordand--provision-full-name). Reading the password from standard input keeps it out of the process list, and it is not echoed when typed at a terminal.config.plistor the registry.This is only exposed to scripting because most users will never need it. There is no wizard or settings UI.
Notes for review:
mainthe window controller restarts the guest automatically after an install, which is the first boot. A fully unattended flow therefore needs a scripted install such as scripting: add an install command for macOS guests #7863 (with scripting: allow creating macOS VMs with the Apple backend #7862 to create the VM): create → install →startwith provisioning.UTMScripting.swiftcontains only the regeneratedstartdeclaration, identical to thebridge-gen.shoutput. The rest of the generator's current output is unrelated to this change (lower-cased class names,b'…'four-char-code comments, and members that were never regenerated onmain), so it is left for a separate catch-up.provisioningparameter and performs a normal start.utmctlships inside the app bundle so the two stay in step.Resolves #7757
Testing
Testing: Tested by a human on macOS 27.0 (26A428), Apple Silicon Mac. The author acknowledges that this change has been tested and/or reviewed by a human in accordance with UTM's AI contribution guidelines.
Verified on a fresh macOS 27.0 guest through both AppleScript and
utmctlwith the password on standard input: the guest boots to the desktop without Setup Assistant, and over SSH the account, full name, administrator rights and automatic login are as requested. Each rejected case fails before the VM starts and leaves it stopped, a saved state survives a rejected request, and the password does not appear inconfig.plist, the registry, preferences or logs. Starting without provisioning is unchanged for Apple and QEMU VMs.