-
Notifications
You must be signed in to change notification settings - Fork 17
Home
This Wiki has some additional hints on using VMs on mac OS 12 based on your experience. NO warranties, this information is provided in the hope to be helpful for experienced users.
The macOS installation (restore) process takes some time, so don't get spooked when it seems stuck at "0%" progress for about a minute. If it's much longer than that then you can start to worry. Also the process has almost non-existent error reporting, so most errors come out simply as "Internal Virtualization Error" and thus are very hard to debug. Note that it requires additional disk space for the installation beyond just the space for the image, so make sure you have ample free disk space before you start, otherwise you simply get the above cryptic error that doesn't mention anything about disk space. Another wild one we encountered was a Timeout error (code 60) when using an excessively large image (when using 32Tb inadvertently instead of 32Gb).
The disk images used by macosvm
are just flat files that correspond to the physical media (block device), so they can be mounted using hdiutil
just like any other device. However, be careful with the boot disk since it contains a full set of partitions including recovery etc. so unwanted changes may render the VM unbootable. You can always use a clone copy (cp -c disk.img test.img
) to have a test image to play with without the danger of modifying your gold master nor using too much extra space. However, it is probably better to add additional non-bootable images to the VM which can be modified safely to separate the data from the OS.
macosvm
is ideal for running self-hosted GitHub runners. As of Nov 2021 arm64 runners they are not officially provided by GitHub, but Hans Kratz has a pull request which creates a working macOS arm64 runner based on his https://github.com/hkratz/gha-runner-osx-arm64 branch. The corresponding package for runner version 2.284.0 is available https://mac.r-project.org/misc/actions-runner-osx-arm64-2.284.0.tar.gz, other version are available in the above repository. You can use an ephemeral runner, start it in the VM from cloned images (disk+aux) followed by shutdown
on completion then each macosvm
process effectively represents one active runner and you can delete the ephemeral cloned disk once macosvm
terminates. This allows you to have a well-defined state which is guaranteed for each runner and code in the runner cannot influence any other runners. The only remaining security concern is networking, but you can use host firewall if you want to limit what the runners are allowed to access on the network.
Starting with macosvm
version 0.1-2 you can use --ephemeral
flag which automatically creates clones of images which are deleted when the process terminates which is ideal for runners (see the NEWS for 0.1-2).