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

# VZMacOSInstaller

An object you use to install macOS on the specified virtual machine.

```
class VZMacOSInstaller
```

## Overview

Initialize a [`VZMacOSInstaller`](/documentation/Virtualization/VZMacOSInstaller) object with a [`VZVirtualMachine`](/documentation/Virtualization/VZVirtualMachine) and a file URL that refers to a macOS restore image.

The following code example shows how to use a `VZMacOSInstaller:`

```swift
// Call VZMacOSInstaller with a URL that corresponds to a local file. 
// This is the storage location for the restore image the app downloads.
let localRestoreImageURL = ...

// Load the latest restore image.
guard let restoreImage = try? await VZMacOSRestoreImage.latestSupported else {
    // Handle the error.
    abort()
}

// Call VZMacOSInstaller with a URL that corresponds to a local file. 
// Because restoreImage came from latestSupported, its URL property refers to a 
// restore image on the network. Download the restore image to the local file system.
guard let (location, _) = try? await URLSession.shared.download(from: restoreImage.url, delegate: nil) 
    else {
        // Handle the error.
        abort()
}

guard ((try? FileManager.default.moveItem(at: location, to: localRestoreImageURL)) != nil) else {
    // Handle the error.
    abort()
}

DispatchQueue.main.async {
    // Becuase this restore image came from VZMacOSRestoreImage.
    // latestSupported, mostFeaturefulSupportedConfiguration should not be nil.
    let configurationRequirements = restoreImage.mostFeaturefulSupportedConfiguration!

    // Construct a VZVirtualMachineConfiguration that satisfies the configuration requirements.
    let configuration = VZVirtualMachineConfiguration()
    configuration.bootLoader = VZMacOSBootLoader()
    configuration.platform = VZMacPlatformConfiguration()

    // The following are minimum values; you can use larger values if desired.
    configuration.cpuCount = configurationRequirements.minimumSupportedCPUCount
    configuration.memorySize = configurationRequirements.minimumSupportedMemorySize

    // Set other configuration properties as necessary.
    // ...

guard ((try? configuration.validate()) != nil) else {
    // Handle the error.
    abort()
}

let virtualMachine = VZVirtualMachine(configuration: configuration)
let installer = VZMacOSInstaller(virtualMachine: virtualMachine, restoringFromImageAt: localRestoreImageURL)
installer.install(completionHandler: { (result: Result) in
    if case let .failure(error) = result {
        // Handle the error.
        abort()
    } else {
        // Installation was successful.
    }
})

// Observe progress using installer.progress object.
}
```

## Topics

### Creating a macOS Installer

[`init(virtualMachine:restoringFromImageAt:)`](/documentation/Virtualization/VZMacOSInstaller/init(virtualMachine:restoringFromImageAt:))

Creates a macOS installer object.

### Getting Information About an Installation

[`progress`](/documentation/Virtualization/VZMacOSInstaller/progress)

A progress object that you can use to observe or cancel an installation.

[`restoreImageURL`](/documentation/Virtualization/VZMacOSInstaller/restoreImageURL)

The restore image URL used to initialize this installer.

[`virtualMachine`](/documentation/Virtualization/VZMacOSInstaller/virtualMachine)

The virtual machine used to initialize this installer.

### Installing macOS

[`install(completionHandler:)`](/documentation/Virtualization/VZMacOSInstaller/install(completionHandler:))

Start installing macOS.

[`install()`](/documentation/Virtualization/VZMacOSInstaller/install())

Start installing macOS.

## See Also

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

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



---

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)