tart run over SSH fails: SecKeyCreateRandomKey_ios failed or "Failed to get current host key"
Since macOS 15, Virtualization.framework needs an unlocked login keychain in the session that starts a macOS VM. Over SSH, as root or from a daemon it is locked or missing. Run the VM as the logged-in user and unlock the login keychain first.

Since macOS 15, Virtualization.framework needs an unlocked login keychain in the session that starts a macOS VM. An SSH session, a root process or a launchd daemon on a Mac nobody has logged in to does not have one, so tart run (and Anka or a custom VZ tool) fails, while the same command works from a GUI or VNC session. Run the VM as a normal user who has logged in graphically at least once, and run security unlock-keychain on that user's login keychain in the same session before starting the VM.
What the error looks like
On macOS 15 hosts, Tart reports a generic start failure:
Error Domain=VZErrorDomain Code=1 "The virtual machine failed to start."
The unified log carries the real reason. The Tart issue and the Tart FAQ list these strings:
SecKeyCreateRandomKey_ios failed
Failed to generate keypair
Interaction is not allowed with the Security Server.
On a macOS 26.4.1 host, an Anka user posted the same failure in a different form, both when starting a VM and, as Code=10007, when installing one from an IPSW:
Error Domain=VZErrorDomain Code=-9 "The virtual machine encountered a security error."
NSLocalizedFailure=Unable to access security information.
Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" ... NSLocalizedFailureReason=Failed to get current host key.
Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" ... NSLocalizedFailureReason=Failed to create new HostKey.
Registry commands hit the keychain too. For tart login, clone, pull and push over SSH the FAQ lists Keychain returned unsuccessful status -25308 and Keychain failed to update item: User interaction is not allowed.
Why it works in a GUI session and not over SSH
The Tart FAQ describes this as an undocumented Virtualization.framework requirement starting with macOS 15 (Sequoia): the framework needs an unlocked login.keychain. A graphical login creates that keychain and unlocks it. An SSH login does not unlock it, which is also what an Apple DTS engineer suggested in the forum thread about Anka.
The second part is the execution context. The same DTS engineer stated that Virtualization is not daemon-safe, because the framework weak-links AppKit. Per TN2083, AppKit requires a per-session GUI context. A user who tried to run VMs from a launchd daemon got Unable to access security information. and was told plainly that this is not something to do (thread). In the Tart issue, users reported that the same command failed as root and worked as a logged-in user.
How to fix it
- Run the VM tool as the user who owns the VMs, not as root. Do not wrap
tart runinsudo, and do not start it from a LaunchDaemon in/Library/LaunchDaemons. - Make sure the user has a login keychain. The FAQ says a graphical login creates
login.keychainautomatically. On a headless Mac mini, EC2 Mac host or rented bare-metal Mac, log in once through Screen Sharing or VNC as that user. Afterwards, check from SSH:
You should seesecurity login-keychain ls ~/Library/Keychains/login.keychain-db. - Unlock it in the same session that starts the VM. Run this in the SSH session, or as a step in the same CI job, right before
tart run:
Withoutsecurity unlock-keychain ~/Library/Keychains/login.keychain-db tart run my-vm-p,securityprompts for the password. For unattended jobs the FAQ notes that-pis supported; pass the value from your CI secret store rather than writing it into a script, because a password on the command line is visible to other processes. - If unlocking alone does not help, re-set the password to itself. Several users reported that the unlock command ran but the VM still failed. The accepted answer in the Apple forum thread, and a report from an EC2 init script in the Tart issue, used this sequence:
This changes the account password, even though the new value is the same. No source explains why it helps. The poster's guess was that something was wrong with the host password. Keep in mind that the security man page says unlocking the login keychain might succeed with an incorrect password, so a successful unlock does not prove the passwords match.sysadminctl -oldPassword "$PW" -newPassword "$PW" security unlock-keychain -p "$PW" ~/Library/Keychains/login.keychain-db
How to confirm it worked
Run the same tart run (or Anka start or install) from the same SSH session or CI job. The VM should boot. The VZErrorDomain error should be gone, and SecKeyCreateRandomKey_ios failed or Failed to get current host key should no longer appear in the log. If it works from an interactive SSH session but not from the runner, the runner is probably starting in a different context, such as root or a daemon.
Running VMs from a CI service
To be safe, run the unlock inside the same job that starts the VM, as the sources do, rather than in a separate SSH login. For a runner that starts at boot, the dependable setup is a logged-in GUI session for the CI user, with the runner as a per-user launchd agent. TN2083 describes agents in ~/Library/LaunchAgents as running on behalf of a user, with Aqua as the default LimitLoadToSessionType.
To get that session without someone logging in after each reboot, you can turn on automatic login with sysadminctl (syntax from SS64):
sudo sysadminctl -autologin set -userName ciuser -password -
(-password - makes sysadminctl prompt for the user's password instead of putting it on the command line.)
This lowers the Mac's security. Apple Support warns that automatic login lets anyone use the Mac just by restarting it, and advises against automatically logging in an administrator. Automatic login is also disabled while FileVault is on. For a build host in a shared rack or a cloud region, use a dedicated non-admin CI account, keep physical and network access tight, and weigh this against unlocking from the job. Some organisations under MDM policy cannot allow automatic login at all. That was the original complaint in the Anka thread, and unlocking per job is the option left for them.
Edge cases
- No GUI access at all. The FAQ gives a fully scripted alternative that creates and unlocks a
login.keychainwith an empty password and sets it withsecurity login-keychain -s login.keychain. The FAQ itself warns that the password is empty and that this method might stop working in the future. Treat it as a last resort. - Do not trust a version comparison too early. In the Anka thread on a 26.4.1 host, the poster first thought 15.x VMs worked and only 26.x VMs failed. They later found that the failure on 15.x showed a different error message that their tooling had not caught. Check the raw
VZErrorDomainerror and the unified log before you decide that a particular guest or host version is the cause. - Keychain locks again.
security set-keychain-settingscontrols this:-llocks on sleep,-ulocks after a timeout and-tsets the timeout in seconds.security show-keychain-infoshows the current settings. Long jobs on a host that sleeps can find the keychain locked again. - Registry credentials. If only
tart pullorpushfails with-25308, the same unlock fixes it. The FAQ also offers environment variables for registry credentials so the keychain is not used.
How to prevent it on new hosts
Add one GUI login to the provisioning checklist for every new headless Mac, so the CI user's login.keychain-db exists before the first job. Run VM tools only as that user. Put the unlock in the same job step as tart run. Do not start Virtualization.framework from a root LaunchDaemon: Apple DTS has said the framework is not daemon-safe and advised against running a macOS VM that way.
Sources
- Tart: Frequently Asked Questions
- GitHub: cirruslabs/tart issue 1067, VM fails to start with SecKeyCreateRandomKey_ios failed
- Apple Developer Forums: autologin required inconsistent for virtualization
- Apple Developer Forums: Running a macOS VM under a launchd daemon
- Apple Developer: TN2083 Daemons and Agents
- security(1) man page (Xcode man pages mirror)
- SS64: sysadminctl
- Apple Support: If you don't see a login window when you start your Mac


