Creating your first VM
Install the Anka CLI
For Anka CLI commands and options, see the Command Reference.
Understanding VM Templates, Tags, and Disk Usage
Anka VM “Templates” contain the base macOS installation and are optimized to minimize disk usage.
You can create Templates using
anka create.
Our getting started guide has some great information on scripting the download of a macOS installer package.
At this time, Anka VM Templates only support the following macOS versions:
10.15.x(macOS Catalina)10.14.x(macOS Mojave)10.13.x(macOS Hi Sierra)10.12.x(macOS Sierra)10.11.x(macOS El Capitan)10.10.x(macOS Yosemite)
After a Template is created, you can use anka view and anka run commands to install and configure whatever dependencies and software you need inside of the VM.
Once you've installed everything you need in a VM, you can then use anka suspend to save the state of the VM.
Saving it as suspended allows for quick boot when you run
anka start.
You can then push the Template to the Registry using anka registry push and set the Tag.
Our use of Tags is similar to docker.
Tags contain only the delta from the base Template or previous Tag, saving a lot of disk space and bandwidth. They can be built in a sequence from the base Template, each new Tag receiving the contents of the last Tag.
Tags store state of the VM Template. So, if you've got TemplateX and a Tag named Tag1 for it, then change the name of TemplateX to TemplateZ, you'll need to create a new Tag to store that difference. The old Tag1 will still store TemplateX.
If you're interested in Infrastructure as Code to automate the creation of your Templates and Tags, you have several options:
- Write scripts that:
- Parse and iterate commands, in order, from a data serialization language like JSON and execute them inside of the VM before suspending and pushing to the Registry.
- Or execute commands on the VM from within the script itself (example).
- Use the Packer Builder: https://github.com/veertuinc/packer-builder-veertu-anka
Lastly, each Template and specific Tag can be cloned to create a new Template. You have two options:
- Use
anka clonewithout-c(recommended): The new cloned Template will have no Tags, but will link to the layers/contents from the previous Template and Tag's state. No new disk space will be used until you modify that new Template. The Tag you create on the new Template will only contain the delta. - Use
anka clonewith-c: The new cloned Template will have no Tags, but will link to the layers/contents from the previous Template and Tag's state. An independent copy of the Template and Tag will be made, in many cases doubling the disk usage.
When creating a clone without
-c, deletion of the first Template will not delete the contents of the second cloned Template. Anka CLI will intelligently know that the layers are still in use by the new Template.
Creating a VM Template
Obtain the macOS installer
There are multiple ways to obtain the installer .app file for Mac OSX that we'll detail for you below:
If you have a pending upgrade to the next minor or patch version of Mac OS:
- Within
Preferences -> Software Update -> Advanced, make sureDownload new updates when availableis checked butInstall macOS updatesis not. While you're still withinSoftware Update, clickUpdate Nowbut do not install the next version (Restart) until after you've created the Anka VM or the Install .app under /Applications will be deleted. - Or on Catalina from the terminal, run
sudo softwareupdate --fetch-full-installer --full-installer-version 10.15.4to download the installer. - You can also use the App Store to download the installer.
- Within
On any Mac OS version you can use the installinstallmacos.py script (requires python):
Download and run the script:
curl --fail --silent -L -O https://raw.githubusercontent.com/munki/macadmin-scripts/master/installinstallmacos.py sudo chmod +x installinstallmacos.py sudo ./installinstallmacos.py --rawThe script downloads an image to the location of the .py script, so further steps are necessary to create an Anka VM:
mkdir -p /tmp/app hdiutil attach "<installinstallmacos.py image path>" -mountpoint /tmp/app cp -r "/tmp/app/Applications/Install Mac OS Mojave.app" /Applications/ hdiutil detach /tmp/app -force rm -f "<installinstallmacos.py image path>"
Have your local IT department provide a network volume or download links.
Generate the Template
sudo anka create --app /Applications/Install\ macOS\ Catalina.app/ 10.15.4
We recommend adding a version to the Template name so it's clear what version of OSX it is.
The VM creation should take around 30 minutes.
The advanced guide for creating Templates and Tags can be found here.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.