bhyve is FreeBSD's native hypervisor. Driving it by hand is verbose, so this tutorial uses vm-bhyve, a popular management tool, with VMs stored on ZFS. Your CPU needs hardware virtualisation (Intel VT-x with EPT, or AMD-V with RVI) enabled in firmware.
1Check hardware support
grep -E 'VT-x|AMD Features2' /var/run/dmesg.boot
kldload vmm && kldstat | grep vmm
2Install and initialise vm-bhyve
pkg install vm-bhyve bhyve-firmware
zfs create zroot/vm
sysrc vm_enable=YES
sysrc vm_dir="zfs:zroot/vm"
vm init
cp /usr/local/share/examples/vm-bhyve/* /zroot/vm/.templates/
bhyve-firmware provides UEFI firmware, needed for UEFI guests and most Linux distributions.
3Create a network switch
A virtual switch bridges guests onto your physical interface.
vm switch create public
vm switch add public em0
vm switch list
4Create and install a guest
vm iso https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/15.1/FreeBSD-15.1-RELEASE-amd64-disc1.iso
vm create -t default -s 20G guest1
vm install guest1 FreeBSD-15.1-RELEASE-amd64-disc1.iso
vm console guest1 # exit the console with ~.
Edit settings such as CPUs and memory with vm configure guest1, which opens the guest's config in your editor (for example cpu=2, memory=2G). The templates copied earlier include examples for other operating systems.
5Run guests
vm list
vm start guest1
vm stop guest1
vm poweroff guest1 # hard stop
sysrc vm_list="guest1" # start at boot
6bhyve without a manager
Under the hood, vm-bhyve calls bhyve and bhyvectl. The Handbook's virtualisation chapter shows how to run a guest directly, which is useful for understanding and debugging.
bhyvectl --vm=guest1 --destroy # clean up a stuck VM instance