
This makes it possible to download an ISO Linux image, attach it to a virtual storage device, create a boot loader, and boot into the OS, as Poulin shows. In macOS Ventura, Apple is introducing support for the EFI boot loader, which is able to discover any virtual device attached to a VM from which to boot. Among supported devices is the GPU, which enables running Metal with almost native performance inside of a VM.Īs mentioned, you can virtualize not only macOS but Linux as well. VirtualMachineView.virtualMachine = virtualMachineĪ VM created in this way is sort-of equivalent to a physical device where you can install the OS, explain Poulin, who also details all the steps required to install and run macOS from an image. Let virtualMachineView = VZVirtualMachineView() Let virtualMachine = VZVirtualMachine(configuration: configuration) Once you have a configuration, you can instantiate and run a virtual machine using VZVirtualMachine as well as attach it to a view to display it inside a macOS window using VZVirtualMachineView: var configuration = VZVirtualMachineConfiguration()ĬmorySize = (4 * 1024 * 1024 * 1024) as UInt64Ĭonfiguration.storageDevices = Ĭonfiguration.pointingDevices =

VZVirtualMachineConfiguration is the core class that allows developers to define the hardware they want to have available in their VMs, including how many CPUs, how much memory, storage, and other devices. Actually, the Virtualization Framework is just a higher-level layer running on top of the Hypervisor Framework, as shown in the following image.

As Apple engineer Benjamin Poulin showed, the Virtualization Framework offers a high-level API to configure and create VMs on macOS using Swift. The Virtualization Framework was introduced in macOS BigSur, a.k.a macOS 11, two years ago as an alternative to the Hypervisor Framework.

New in the upcoming macOS Ventura, Linux VMs can leverage the GPU and use Rosetta to run unmodified x86-64 Linux binaries. Apple Virtualization Framework enables configuring and creating virtual machines on Apple Silicon to run macOS or Linux. At WWDC 2022, Apple showcased its latest advancement in virtualization support on macOS.
