<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZVirtualMachine/restoreMachineStateFrom(url:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZVirtualMachine(im)restoreMachineStateFromURL:completionHandler:"
  },
  "title" : "restoreMachineStateFrom(url:completionHandler:)"
}
-->

# restoreMachineStateFrom(url:completionHandler:)

Restores a VM from a previously saved state.

```
func restoreMachineStateFrom(url saveFileURL: URL, completionHandler: @escaping ((any Error)?) -> Void)
```

## Parameters

`saveFileURL`

An <doc://com.apple.documentation/documentation/Foundation/NSURL> that indicates the location where the framework reads the saved state of the VM.

`completionHandler`

A block the framework calls after the VM has been successfully restored or upon an error.

## Discussion

Use this method to restore a stopped VM to a state previously saved to file through [`saveMachineStateTo(url:completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/saveMachineStateTo(url:completionHandler:)).

The method fails if any of the following conditions are true:

- The Virtualization framework can’t open or read the file.
- The file contents are incompatible with the current configuration.
- The VM you’re trying to restore isn’t in the [`VZVirtualMachine.State.stopped`](/documentation/Virtualization/VZVirtualMachine/State-swift.enum/stopped) state.

If this method fails, the framework returns an error, and the VM state doesn’t change.

If this method is successful, the framework restores the VM and places it in the paused state.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)