https://github.com/gyf304/vmcli

VMCLI

A set of utilities to help you manage VMs with Virtualization.framework

vmctl-demo

Installation

Prerequisites

# make sure xcode command-line tools are installed
xcode-select --install

# run build, install. This will install vmcli and vmctl to /usr/local/bin
make
sudo make install

You have now finished installing vmcli and vmctl

Set environment variable VMCTLDIR to ~/VMs so vmctl knows how to find VMs. If you don't set this, vmctl will use current working directory to find VMs.

echo 'export VMCTLDIR="$HOME/VMs"' >> ~/.zprofile
export VMCTLDIR="$HOME/VMs"

Provision a Ubuntu VM, and install that to ~/VMs. The VM will auto create your user with your ssh public key at ~/.ssh/id_rsa.pub.

make build/vm/ubuntu
mv build/vm/ubuntu "${VMCTLDIR}/ubuntu"

Optionally expand the VM volume, for example to 16G.

dd if=/dev/null of="${VMCTLDIR}/ubuntu/disk.img" bs=1g count=0 seek=16

Optionally edit the VM config for more RAM and/or CPU cores

vi "${VMCTLDIR}/ubuntu/vm.conf"

Start the VM