Architecture and Virtual Devices

vftool acts as a lightweight command-line interface for Apple's Virtualization.framework, a high-level API for creating and managing virtual machines on macOS.

Instead of implementing a hypervisor itself, vftool's primary role is to translate your command-line arguments into a valid VZVirtualMachineConfiguration object. This configuration object describes the VM's hardware, boot parameters, and devices. Once the configuration is built and validated, vftool simply instructs the framework to start the VM.

All of the heavy lifting—CPU virtualization, memory management, and device emulation—is performed efficiently and securely by the underlying Virtualization.framework.

Virtual Devices

Virtualization.framework provides a specific set of modern, high-performance virtual devices based on the Virtio standard. vftool configures the following essential devices for every VM:

  • Boot Loader (VZLinuxBootLoader): This object is configured with the paths to your kernel, optional initrd, and the kernel command line arguments. It instructs the framework on how to boot a Linux guest.

  • Serial Console (VZVirtioConsoleDeviceSerialPortConfiguration): This creates a virtio-based serial port, which serves as the primary text console for the VM (hvc0 in the guest). vftool attaches this virtual port to either a host pseudo-terminal (pty) or its own standard I/O.

  • Network Adapter (VZVirtioNetworkDeviceConfiguration): A virtio network interface is created for the guest. vftool attaches this to a NAT or Bridged backend. See the Networking guide for details.

  • Entropy Device (VZVirtioEntropyDeviceConfiguration): This provides a source of randomness to the guest operating system, which is crucial for cryptographic operations and for preventing slow boot times on some systems.

  • Storage Controller (VZVirtioBlockDeviceConfiguration): For each disk or CD-ROM image you specify with -d or -c, vftool creates a virtio block device. These appear as /dev/vda, /dev/vdb, etc., in the guest. See the Storage guide for details.

Because all I/O is handled through these modern virtio-pci devices, guest operating systems must have the necessary virtio drivers to function correctly.