-
-
Notifications
You must be signed in to change notification settings - Fork 50
Home
The Virtualization framework can run Linux VMs on a Mac with Apple silicon, and on an Intel-based Mac. The Linux ISO image you download must support the CPU architecture of your Mac.
- A Mac with Apple silicon
- Download a Linux ISO image for ARM, which is usually indicated by aarch64 or arm64 in the image filename.
- An Intel-based Mac
- Download a Linux ISO image for Intel-compatible CPUs, which is usually indicated by x86_64 or amd64 in the image filename.
If you need to run Intel Linux binaries in ARM Linux on a Mac with Apple silicon, the Virtualization framework supports this capability using the Rosetta translation environment in macOS 13 and later. For more information, see Running Intel Binaries in Linux VMs with Rosetta.
You need PCI support in any case as the Virtio devices are on the PCI bus. It can be supported by enabling CONFIG_VIRTIO_PCI
within the kernel (not as a module).
- Serial console needs
console=hvc0
kernel parameter and your Linux kernel is required to enableCONFIG_VIRTIO_CONSOLE
andCONFIG_HVC_DRIVER
. - Must be enabled
CONFIG_VIRTIO_BALLOON
to use the memory balloon device. - Must be enabled
CONFIG_VIRTIO_BLK
to use the block device.- Only RAW disk images on APFS are supported. Other formats are not supported.
- Must be enabled
CONFIG_VIRTIO_NET
to use the network device.- With NAT, based on the MAC address used for the device the IP address of the VM can be found in
/var/db/dhcpd_leases
.
- With NAT, based on the MAC address used for the device the IP address of the VM can be found in
- Shared Directories
Request Stop in Virtualization.framework depends on the CPU you are using.
On Apple Silicon Macs, the shutdown is signaled through the PL061. In order to use it, the kernel needs to be compiled with that device (CONFIG_GPIO_PL061
). From user space, a process like acpid
can turn the event into an action. CONFIG_INPUT_EVDEV
and CONFIG_KEYBOARD_GPIO
must also be enabled for these processes to handle events.
If you want to handle with acpid
in such as an init script, you can use the following scripts for a shutdown.
mkdir -p /etc/acpi/PWRF
echo '#!/bin/sh' > /etc/acpi/PWRF/00000080
echo 'poweroff' >> /etc/acpi/PWRF/00000080
chmod +x /etc/acpi/PWRF/00000080
acpid
On Intel Macs, the stop request is done through the ICH9. The PM1_STS’s Power Button Status (PWRBTN_STS) is set in response to the request.