I'm looking for clarification on the supported lifecycle semantics of VZVirtualMachine on macOS.
Suppose process A creates and starts a VZVirtualMachine. While that VM is running, process A unexpectedly terminates or crashes.
What is the supported behavior of that same original running VM instance?
-
Is the VM automatically stopped or terminated when its owning process exits or crashes?
-
If the VM can continue running, is there a supported API for a newly started process B to reconnect to or obtain control of that same already-running VM instance?
-
If process B can reacquire the original VM, can it then force noncooperative termination of that instance, equivalent to using stop(completionHandler:) while the original controlling object still exists?
-
Is there a supported way for process B to determine authoritatively that the original VM has stopped after process A is gone?
-
Are there relevant differences between normal process exit, an unexpected crash, and forced process termination?
I'm specifically asking about the same original running VM instance. Creating a new VZVirtualMachine with the same configuration, or restoring previously saved machine state, would not answer the question.
If the owner-loss behavior is intentionally unspecified, or if there is no supported mechanism for another process to reacquire the same running VM, that would also answer the question.
I'm interested in the supported Virtualization.framework contract rather than experimentally observed behavior.
Environment: macOS 26.5.1 on Apple Silicon.
I was reviewing recent Virtualization questions and realised that we’d never driven this to a conclusion.
There have been a tonne of forums threads related to this task recently. I recommend that you review all the recent threads for the Virtualization tag. Specifically, check out this thread.
If you have follow-up questions, put them in a reply here and I’ll take a look.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"