<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZVirtualMachine",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZVirtualMachine"
  },
  "title" : "VZVirtualMachine"
}
-->

# VZVirtualMachine

An object that manages the overall state and configuration of your VM.

```
class VZVirtualMachine
```

## Overview

A [`VZVirtualMachine`](/documentation/Virtualization/VZVirtualMachine) object emulates a complete hardware machine of the same architecture as the underlying Mac computer. Use the VM to execute a guest operating system and any other apps you install. The VM manages the resources that the guest operating system uses, providing access to some hardware resources while emulating others.

Create and configure a [`VZVirtualMachineConfiguration`](/documentation/Virtualization/VZVirtualMachineConfiguration) object with details about how you want to configure your VM, and use that object to create the [`VZVirtualMachine`](/documentation/Virtualization/VZVirtualMachine) object. After creating the VM, call the [`start(completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/start(completionHandler:)) method (Swift)  or the [`start()`](/documentation/Virtualization/VZVirtualMachine/start()) method (Objective-C) to start the VM and boot the guest operating system.

> Important:
> The creation of a virtual machine requires your app to have the <doc://com.apple.documentation/documentation/BundleResources/Entitlements/com.apple.security.virtualization> entitlement.

## Topics

### Creating the VM

[`init(configuration:)`](/documentation/Virtualization/VZVirtualMachine/init(configuration:))

Creates the VM and configures it with the specified data.

[`init(configuration:queue:)`](/documentation/Virtualization/VZVirtualMachine/init(configuration:queue:))

Creates and configures the VM with the specified data and dispatch queue.

[`isSupported`](/documentation/Virtualization/VZVirtualMachine/isSupported)

A Boolean value that indicates whether the system supports virtualization.

### Responding to a stopped VM

[`delegate`](/documentation/Virtualization/VZVirtualMachine/delegate)

A custom object you use to determine when the VM stops.

[`VZVirtualMachineDelegate`](/documentation/Virtualization/VZVirtualMachineDelegate)

The methods you use to respond to changes in the state of the VM.

### Starting and stopping the VM

[`start(completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/start(completionHandler:))

Starts the VM and notifies the specified completion handler if startup is successful.

[`start()`](/documentation/Virtualization/VZVirtualMachine/start())

Starts the VM and notifies the specified completion handler if startup was successful.

[`start(options:completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/start(options:completionHandler:))

Starts the VM with the options and a completion handler you provide.

[`stop(completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/stop(completionHandler:))

Stops a VM that’s in either a running or paused state.

[`pause(completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/pause(completionHandler:))

Pauses a running VM and notifies the specified completion handler of the results.

[`requestStop()`](/documentation/Virtualization/VZVirtualMachine/requestStop())

Asks the guest operating system to stop running.

[`resume(completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/resume(completionHandler:))

Resumes a paused VM and notifies the specified completion handler of the results.

[`pause()`](/documentation/Virtualization/VZVirtualMachine/pause())

Pauses a running VM and notifies the specified completion handler of the results.

[`resume()`](/documentation/Virtualization/VZVirtualMachine/resume())

Resumes a paused VM and notifies the specified completion handler of the results.

[`VZVirtualMachineStartOptions`](/documentation/Virtualization/VZVirtualMachineStartOptions)

The abstract class for VM start options.

### Configuring VM attributes at runtime

[`consoleDevices`](/documentation/Virtualization/VZVirtualMachine/consoleDevices)

The list of configured console devices on the VM.

[`memoryBalloonDevices`](/documentation/Virtualization/VZVirtualMachine/memoryBalloonDevices)

The array of devices that you use to adjust the amount of memory available to the guest system.

[`networkDevices`](/documentation/Virtualization/VZVirtualMachine/networkDevices)

The list of configured network devices on the VM.

[`socketDevices`](/documentation/Virtualization/VZVirtualMachine/socketDevices)

The array of socket devices that the VM configures for use ports in the guest VM.

[`directorySharingDevices`](/documentation/Virtualization/VZVirtualMachine/directorySharingDevices)

The list of configured directory-sharing devices on the VM.

[`usbControllers`](/documentation/Virtualization/VZVirtualMachine/usbControllers)

The list of runtime USB controller objects.

### Getting the state of the VM

[`state`](/documentation/Virtualization/VZVirtualMachine/state-swift.property)

The current execution state of the VM.

[`VZVirtualMachine.State`](/documentation/Virtualization/VZVirtualMachine/State-swift.enum)

The execution states of the VM.

[`graphicsDevices`](/documentation/Virtualization/VZVirtualMachine/graphicsDevices)

The list of configured graphics devices on the virtual machine.

[`canStart`](/documentation/Virtualization/VZVirtualMachine/canStart)

A Boolean value that indicates whether you can start the VM.

[`canPause`](/documentation/Virtualization/VZVirtualMachine/canPause)

A Boolean value that indicates whether you can pause the VM.

[`canResume`](/documentation/Virtualization/VZVirtualMachine/canResume)

A Boolean value that indicates whether you can resume the VM.

[`canStop`](/documentation/Virtualization/VZVirtualMachine/canStop)

A Boolean value that indicates whether you can stop the VM.

[`canRequestStop`](/documentation/Virtualization/VZVirtualMachine/canRequestStop)

A Boolean value that indicates whether you can ask the guest operating system to stop running.

[`queue`](/documentation/Virtualization/VZVirtualMachine/queue)

The queue associated with this virtual machine.

### Saving and restoring the VM state

[`saveMachineStateTo(url:completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/saveMachineStateTo(url:completionHandler:))

Saves the state of a VM.

[`restoreMachineStateFrom(url:completionHandler:)`](/documentation/Virtualization/VZVirtualMachine/restoreMachineStateFrom(url:completionHandler:))

Restores a VM from a previously saved 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)