Schema reference
Every object and field of lab.yaml, generated from the JSON Schema (https://raw.githubusercontent.com/rayanparsa/vz/refs/heads/main/schema/27.json).
- Lab file reference explains what each part does, with examples.
- Validation lists the checks
vz validateruns beyond the schema, such as names that must exist, subnets that must not overlap and MACs that must be unique.
Keys not listed here are errors. Paths are relative to the lab file, and ~ is your home folder.
Map
lab.yaml
├── storages.<name> Storage
├── nodes[] Node
│ ├── disks[] Disk
│ ├── shares[] Share
│ ├── displays[] Display
│ ├── sound Sound
│ ├── usb[] USB device
│ └── interfaces[] Interface
├── links.<name> Link
└── switches.<name> Switch
├── dhcpReservations[] DHCP reservation
└── portForwarding[] Port forwarding ruleContents
- Lab
- Storage:
storages.<name> - Node:
nodes[] - Disk:
nodes[].disks[] - Share:
nodes[].shares[] - Display:
nodes[].displays[] - Sound:
nodes[].sound - USB device:
nodes[].usb[] - Interface:
nodes[].interfaces[] - Link:
links.<name> - Switch:
switches.<name> - DHCP reservation:
switches.<name>.dhcpReservations[] - Port forwarding rule:
switches.<name>.portForwarding[] - Value formats: name, size, mac, ipv4Cidr, ipv6Prefix, port, mtu, usbId
Lab
The top level of lab.yaml.
Declarative lab for vz: Linux and macOS VMs, vmnet switches and socketpair links on macOS 27 Virtualization.framework. Only infrastructure is described; nothing inside the guests is configured, except an optional cloud-init seed supplied by the user.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
schemaVersion | 27 | yes | Version of the lab file format, named after the macOS release it is for: 27 is macOS 27, matching this file's name (27.json). | |
name | name | yes | Lab name. Used for stable MAC addresses, cloud-init instance-id, the background process and 'vz ls'. Must be unique among running labs. | |
state | string, not empty | Directory for per-node runtime state: UEFI variable store, machine identifier, disk overlays and cache layers, console logs, cloud-init seeds, control socket. Relative to the lab file. Default: ~/.vz/state/<name>. Two labs must never share a state directory. | ||
storages | map of name to storage | {} | Named, reusable disks. A writable storage can be used by only one running node at a time; read-only use can be shared (checked by vz). | |
nodes | list of node | yes | Virtual machines: generic UEFI machines that boot their disks, or macOS guests (platform: apple). Node names must be unique (checked by vz). | |
links | map of name to link | {} | Point-to-point cables (socketpair + VZFileHandleNetworkDeviceAttachment). Each link must be referenced by exactly two interfaces on two different nodes (checked by vz). | |
switches | map of name to switch | {} | Virtual switches backed by vmnet networks (vmnet_network_create + VZVmnetNetworkDeviceAttachment). The Mac host is always a member. |
Storage
Where: storages.<name>
A named disk file. Nodes use it from disks with storage: <name>.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
path | string, not empty | yes | Disk file. Format is inferred from the extension (.asif, .raw/.img, .iso, .ipsw). Created if missing and size is set (.asif and .raw/.img only). | |
size | size | Size used when creating the file. |
storages:
shared:
path: disks/shared.asif
size: 20GiBNode
Where: nodes[]
A VM. platform picks the machine type (generic by default). Generic nodes boot with UEFI (VZEFIBootLoader) and a serial console (live via 'vz node console'). Apple nodes run macOS: Mac graphics (vz node display), no serial console, and an install from the listed IPSW on the first start. Always present, no keys: entropy (VZVirtioEntropyDeviceConfiguration), memory balloon (VZVirtioTraditionalMemoryBalloonDeviceConfiguration). Keyboard and pointer are added automatically with a display (one by default).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | name | yes | Node name. Also the guest hostname cloud-init sets, and the name vz node commands take. | |
platform | generic | apple | generic | Machine type. generic: Apple's generic Arm machine with UEFI firmware and the virtio serial console; it boots whatever the disks hold (Linux, an installer ISO, your own OS). apple: Apple's Mac machine for macOS; list a .ipsw restore image under disks and macOS installs onto the first other disk on the first start. Experimental. | |
cpus | integer, at least 1 | 1 | VZVirtualMachineConfiguration.cpuCount | |
memory | size | 1GiB | VZVirtualMachineConfiguration.memorySize | |
nestedVirtualization | boolean | false | VZGenericPlatformConfiguration.isNestedVirtualizationEnabled. Requires M3 or newer. Generic platform only. | |
secureBoot | boolean | false | UEFI Secure Boot for Linux guests (macOS 27). Only signed bootloaders and kernels will boot. Generic platform only. | |
rosetta | boolean | false | Expose Rosetta to the guest (VZLinuxRosettaDirectoryShare) with tag 'rosetta'. Generic platform only. | |
consoleLog | boolean | false | Also write the serial console to <state>/<node>/console-<timestamp>.log, one file each time the lab starts the node (a reboot inside the guest keeps writing to the same file). | |
disks | list of disk, at least 1 | yes | Storage devices in boot order. UEFI boots from the first bootable one. A .ipsw (platform apple) is installer media: read by the installer, never attached, and it keeps its index. | |
init | string, not empty | First-boot data. generic: a cloud-init NoCloud seed, attached as a read-only 'cidata' disk after all other disks; a file is used as user-data (vz generates meta-data with instance-id and local-hostname), a directory is packed as-is (user-data, meta-data, network-config, vendor-data). apple: the same #cloud-config user-data, read by vz: the first user (name, plain_text_passwd or chpasswd, gecos) becomes the account macOS creates on its first boot, and ssh_pwauth turns Remote Login on (default) or off. | ||
shares | list of share | [] | VirtioFS shares (VZVirtioFileSystemDeviceConfiguration + VZSingleDirectoryShare), one folder per item. Mount in guest with: mount -t virtiofs <tag> <dir>. Tags must be unique per node and 'rosetta' is reserved (checked by vz). | |
displays | list of display | [{width: 1280, height: 800}] | VZVirtioGraphicsDeviceConfiguration scanouts. 2D only, no GPU acceleration. Shown in a vz window (VZVirtualMachineView) by 'vz node display'. Without this key a node gets one 1280x800 display; [] turns graphics off. | |
clipboard | boolean | false | Clipboard sharing via SPICE agent port (VZSpiceAgentPortAttachment). Needs displays and spice-vdagent in the guest. Generic platform only. | |
sound | sound | VZVirtioSoundDeviceConfiguration. Uses the macOS default output and input devices. | ||
usb | list of usb device | [] | USB passthrough via Accessory Access (macOS 27). Needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement; ad-hoc signed builds cannot claim USB devices. Isochronous devices (webcams, USB audio) are not expected to work. | |
interfaces | list of interface | [] | NICs (VZVirtioNetworkDeviceConfiguration). List order is PCI order in the guest. Interface names must be unique within the node (checked by vz). |
Rules:
- When
clipboard: true:displaysneeds at least 1 entry.
nodes:
- name: vm1
cpus: 2
memory: 2GiB
disks:
- path: ~/.vz/images/debian-13-genericcloud-arm64.raw
overlay: true
size: 20GiB
init: init/vm1
interfaces:
- name: mgmt
attach: switch/mgmt
mac: "52:54:00:30:01:00"Disk
Where: nodes[].disks[]
A disk of a node: a file (path) or a named storage (storage).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
bus | virtio | nvme | usb | virtio | virtio: VZVirtioBlockDeviceConfiguration (/dev/vdX). nvme: VZNVMExpressControllerDeviceConfiguration (/dev/nvmeXn1). usb: VZUSBMassStorageDeviceConfiguration (removable at runtime). | |
path | string, not empty | Disk file. Format is inferred from the extension (.asif, .raw/.img, .iso, .ipsw). Created if missing and size is set (.asif and .raw/.img only). | ||
storage | name | Name of an entry in storages. | ||
size | size | With path: size of a new file when the file is missing. With overlay: the size the guest sees, 10GiB when not set (or the base image size, if larger). At least the base image; can grow later, never shrink. The guest grows its partition itself, e.g. cloud-init growpart on boot. | ||
readOnly | boolean | false | Attach the disk read-only: the guest cannot write to it. | |
overlay | boolean | false | DiskImageKit stack: the file is a read-only base, writes go to a private ASIF overlay in the state directory. | |
cache | boolean | false | Add an ASIF cache layer between base and overlay, for bases on slow storage (NAS). Requires overlay. | |
caching | automatic | cached | uncached | automatic | VZDiskImageCachingMode | |
sync | full | fsync | none | full | VZDiskImageSynchronizationMode | |
connected | boolean | true | USB disks only: plugged in at boot. Can be detached and attached at runtime. |
Rules:
- When
cache: true:overlay: trueis needed. - When
connectedis set:bus: usbis needed. - Set exactly one of
pathandstorage. sizeis not allowed withstorage.
nodes:
- name: vm1
disks:
- path: ~/.vz/images/debian-13-genericcloud-arm64.raw
overlay: true
size: 20GiBShare
Where: nodes[].shares[]
A folder on the Mac shared with the guest over VirtioFS.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
tag | string matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,35}$ | yes | VirtioFS tag used by the guest to mount the share. | |
path | string, not empty | yes | Folder on the Mac. Relative to the lab file; ~ allowed. | |
readOnly | boolean | false | The guest can read the folder but not write to it. |
nodes:
- name: vm1
shares:
- tag: code
path: ~/src
readOnly: trueDisplay
Where: nodes[].displays[]
A virtual display. Open its window with vz node display.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
width | integer, 320 to 8192 | yes | Width in pixels. | |
height | integer, 200 to 8192 | yes | Height in pixels. |
nodes:
- name: vm1
displays:
- width: 1920
height: 1080Sound
Where: nodes[].sound
VZVirtioSoundDeviceConfiguration. Uses the macOS default output and input devices.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
output | boolean | false | Play guest audio on the Mac's default output device. | |
input | boolean | false | Give the guest the Mac's default input device (microphone). |
nodes:
- name: vm1
sound:
output: trueUSB device
Where: nodes[].usb[]
USB passthrough via Accessory Access (macOS 27). Needs a vz signed with a Developer ID and the com.apple.developer.accessory-access.usb entitlement; ad-hoc signed builds cannot claim USB devices. Isochronous devices (webcams, USB audio) are not expected to work.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
vendorId | usbId | yes | USB vendor id of the device, as lsusb or System Information shows it. | |
productId | usbId | yes | USB product id of the device. |
nodes:
- name: vm1
usb:
- vendorId: "0x0403"
productId: "0x6001"Interface
Where: nodes[].interfaces[]
A network card (virtio). attach decides what it is plugged into.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string matching ^[a-zA-Z][a-zA-Z0-9._-]{0,14}$ | yes | Label used by vz to reference this NIC. Not pushed into the guest. | |
attach | string matching ^(switch|link)/[a-z][a-z0-9-]{0,62}$ | What this NIC is plugged into: switch/<name> or link/<name>. Omit for a free NIC. | ||
mac | mac | MAC address (VZMACAddress). If omitted, vz derives a stable one from lab, node and interface names. | ||
connected | boolean | true | Whether the cable is plugged in at boot. Toggled at runtime by swapping the NIC attachment. |
Rules:
connectedneedsattach.
nodes:
- name: vm1
interfaces:
- name: eth1
attach: link/r1-r2
connected: trueLink
Where: links.<name>
A point-to-point cable between two NICs on two different nodes. The Mac is not a member.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
mtu | mtu | 1500 | VZFileHandleNetworkDeviceAttachment.maximumTransmissionUnit, applied to both ends. | |
buffer | size | Advanced: SO_SNDBUF/SO_RCVBUF of the socketpair. vz picks a default. |
links:
r1-r2:
mtu: 9000Switch
Where: switches.<name>
A vmnet network. The Mac is always a member and gets the first address of the subnet.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
nat4 | boolean | false | IPv4 NAT to the internet. false -> vmnet_network_configuration_disable_nat44. If nat4 and nat6 are both false the switch uses VMNET_HOST_MODE, otherwise VMNET_SHARED_MODE. | |
nat6 | boolean | false | IPv6 NAT to the internet. false -> vmnet_network_configuration_disable_nat66. | |
ipv4Subnet | ipv4Cidr | vmnet_network_configuration_set_ipv4_subnet. The Mac gets the first address. Must not overlap other switches (checked by vz). | ||
ipv6Prefix | ipv6Prefix | vmnet_network_configuration_set_ipv6_prefix | ||
mtu | mtu | 1500 | vmnet_network_configuration_set_mtu | |
dhcp | boolean | true | Built-in DHCP server. false -> vmnet_network_configuration_disable_dhcp. | |
dhcpReservations | list of dhcp reservation | [] | Optional fixed IPv4 addresses by MAC (vmnet_network_configuration_add_dhcp_reservation, IPv4 only). Without them, guests get addresses from the DHCP pool. MAC should match an interface attached to this switch (checked by vz). | |
dnsProxy | boolean | true | Built-in DNS proxy. false -> vmnet_network_configuration_disable_dns_proxy. | |
routerAdvertisement | boolean | true | IPv6 router advertisement. false -> vmnet_network_configuration_disable_router_advertisement. | |
portForwarding | list of port forwarding rule | [] | vmnet_network_configuration_add_port_forwarding_rule. Only valid when NAT is enabled. |
Rules:
- When
nat4: false(also when not set) andnat6: false(also when not set):portForwardingis not allowed. - When
dhcp: false:dhcpReservationsis not allowed.
switches:
mgmt:
nat4: true
ipv4Subnet: "10.30.0.0/24"
dhcpReservations:
- mac: "52:54:00:30:01:00"
ipv4: "10.30.0.11"
portForwarding:
- protocol: tcp
hostPort: 2222
address: "10.30.0.11"
guestPort: 22DHCP reservation
Where: switches.<name>.dhcpReservations[]
Optional fixed IPv4 addresses by MAC (vmnet_network_configuration_add_dhcp_reservation, IPv4 only). Without them, guests get addresses from the DHCP pool. MAC should match an interface attached to this switch (checked by vz).
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
mac | mac | yes | MAC of a NIC on this switch. | |
ipv4 | IPv4 address | yes | Address the DHCP server always gives that MAC. Must be inside ipv4Subnet. |
switches:
mgmt:
dhcpReservations:
- mac: "52:54:00:30:01:00"
ipv4: "10.30.0.11"Port forwarding rule
Where: switches.<name>.portForwarding[]
vmnet_network_configuration_add_port_forwarding_rule. Only valid when NAT is enabled.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
protocol | tcp | udp | yes | tcp or udp. | |
family | ipv4 | ipv6 | Address family. If omitted, inferred from address. | ||
hostPort | port | yes | Port on the Mac. | |
address | IPv4 address or IPv6 address | yes | Guest address on this switch. | |
guestPort | port | yes | Port on the guest. |
switches:
mgmt:
portForwarding:
- protocol: tcp
hostPort: 2222
address: "10.30.0.11"
guestPort: 22Value formats
Fields above that link here share these formats.
name
Name of a lab, node, storage, link or switch: a lowercase letter, then lowercase letters, digits and hyphens, 63 characters at most.
- Type: string matching
^[a-z][a-z0-9-]{0,62}$ - Examples:
lab,web-1
size
Byte size with binary unit, e.g. 512MiB, 2GiB.
- Type: string matching
^[0-9]+(B|KiB|MiB|GiB|TiB)$ - Examples:
512MiB,2GiB,20GiB
mac
MAC address (VZMACAddress). If omitted, vz derives a stable one from lab, node and interface names.
- Type: string matching
^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$ - Examples:
"52:54:00:0a:00:01"
ipv4Cidr
IPv4 subnet in CIDR notation.
- Type: string matching
^((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])/([0-9]|[12][0-9]|3[0-2])$ - Examples:
"10.30.0.0/24"
ipv6Prefix
IPv6 prefix with its length.
- Type: string matching
^[0-9a-fA-F:]+/([0-9]|[1-9][0-9]|1[01][0-9]|12[0-8])$ - Examples:
fd00:30::/64
port
TCP or UDP port number.
- Type: integer, 1 to 65535
- Examples:
22,8080
mtu
Maximum transmission unit in bytes, from 1280 (the IPv6 minimum) to 65535.
- Type: integer, 1280 to 65535
- Examples:
1500,9000
usbId
16-bit USB id, as a YAML integer (0x0403) or a hex string ("0x0403").
- Type: integer, 0 to 65535 or string matching
^0x[0-9a-fA-F]{4}$ - Examples:
"0x0403",1027