Creating VMs

Anka makes it very simple to get started creating a new VM. Use anka create to create a quick workflow for setting up a new VM. When creating VMs for usage with Anka, you have several methods, detailed below:

Use macOS installer Application method to create HiSierra Anka VMs.

Note - Use anka --machine-readable to get machine readable output from all anka commands.

anka create lets you create a VM by specifying *.app installer package of macOS. anka create --ram-size 4G --cpu-count 2 --disk-size 60G --app /Applications/Install\ macOS\ High\ Hisierravm

By default anka create creates macOS VM with administrative user - anka and password - admin. You can change this default user by using these ENV variables with anka create command.

ANKA_DEFAULT_PASSWD=passwd ANKA_DEFAULT_USER=usrname anka create --ram-size 4G --cpu-count 2 --disk-size 60G -a /Applications/Install\ macOS\ High\ HiSierravm

Usage: anka create [OPTIONS] VMNAME

  Creates a VM

  -m, --ram-size TEXT      ram size in G  [default: 2G]
  -c, --cpu-count INTEGER  the number of cpu cores  [default: 2]
  -d, --disk-size TEXT     sets the disk size when creating a new disk, G/M
                           suffix needed  [default: 60G]
  -a, --app PATH           Path to Install macOS Application (downloadable
                           from AppStore)
  -p, --pkg PATH           Additional package to be installed
  -s, --postinstall PATH   Postinstall scripts (to run with root credentials
                           at first boot)
  --help                   Show this message and exit.

Example - Creating a HiSierra VM with 4G ram, 2vCPU & 60G disk. You can specify different values of these parameters while creating a VM for your need.

Note - While creating VM with anka create, make sure to specify enough --disk-size. Currently, it’s not possible to change the disk size for an existing VM.

anka create --ram-size 4G --cpu-count 2 --disk-size 60G --app /Applications/Install\ macOS\ High\ build73sierra
Installing macOS 10.13...
Preparing target disk...
Copying addons...
Converting to ANKA format...
Waiting for installation to complete in the guest (about thirty minutes approx.)...
vm created successfully with uuid: 8f0e1111-a14b-11e7-aaa4-003ee1cbb8b4

Note - VMs are created with SIP/Kext Consent disabled by default. It’s strongly advised to keep these settings for optimal Anka performance. SIP/Kext Consent can be enabled with the following command anka modify VMNAME set custom-variable sys.csr-active-config 0.

VMs created are in suspended mode to enable fast boot/Instant Start. VMs are created with SIP disabled.

Start the VM

The VM can now be successfully started. The VM is preconfigured with a default administrative username Anka and password admin. You will see the VM boot up and have to complete the macOS keypad setup steps.

anka start sierravm
| uuid                  | f19bb3b3-5d1a-11e8-8cec-acbc32ad1d59 |
| name                  | sierravm                             |
| cpu_cores             | 2                                    |
| ram                   | 4G                                   |
| hard_drive            | 40 GB (9.4 GB on disk)               |
| addons_version        |                             |
| status                | running                              |
| vnc_connection_string | vnc://:admin@xx.x.x.xx:5900          |
| view_vm_display       | anka view sierravm                   |

Validate by running the following command anka run VMNAME ls -l from the host. It should display ls -l contents of the host current directory. The VM is correctly created. You can manually work with the VM with anka view sierravm. This will open the VM window.

Troubleshooting Tip

If anka create process fails, go to /var/log/install.log and look for error description. It could be due to lack of free space on root.

Preparing VM with your dependencies

You can prepare VM with your custom project dependencies in multiple ways.

Option 1

Use ‘anka run’ command from host to install dependencies inside the VM. Use the following commands to install Xcode in the macOS Anka VM created from the previous step. These steps use the APpstore username and password credentials to download XCode.

anka run -n -N vmname ruby -e "$(curl -fsSL"
anka run -n vmname sudo gem install xcode-install

#saving user/pass of app store
echo FASTLANE_USER=user >> appstore_login
echo FASTLANE_PASSWORD=password >> appstore_passwd

anka run -f appstore_login -nE vmname xcversion install 10.1

Check Bootstrapping Anka VM blog for detailed instructions (

Option 2

SSH (see devops section documentation on configuring port forwarding for SSH) into the VM and execute existing ansible/chef scripts. Configure port forwarding on the VM for ssh.

anka modify vmname add port-forwarding --host-port 0 --guest-port 22 --protocol tcp ssh
rule added successfully

Option 3

Use the anka create --postinstall flag to include custom scripts. These scripts will run with root privileges after the VM is created and booted. You can also specify multiple scripts separated with comma. They will execute in serial, random manner.

Option 4

Use the anka create --pkg flag to include custom packages to initialize VM, after its created. An example, would be a usercreation pkg.

Mojave VM Support

Anka now supports creating and running Mojave VMs on machines running Sierra, HiSierra and Mojave as the host macOS. Use the anka create command to create Mojave Anka VMs.

Using an ISO file to create Anka VM - Yosemite & ElCapitan VMs

Use included in the Anka package to first create an .iso from your Yosemite and ElCapitan .app installer. If you already have .iso file, you don’t need to execute this step.

/Library/Application\ Support/Veertu/Anka/tools/
Usage: [OPTIONS]...

--g,--guest-addons       Embed Anka guest addons in the installer
--o,--output output.iso       Specify output image file, if not specified the image will be created in working directory                  
--p,--pkg path/to/pkg Specify additional packages to include into the installer

For example:

/Library/Application\ Support/Veertu/Anka/tools/ /Applications/Install\ macOS\

To create a VM from .iso, you will use anka create command as you typically would. It will create an empty VM. Note - > While creating VM with anka create, make sure to specify enough --disk-size parameter. Currently, it’s not possible to change the disk size for an existing VM.

anka create --ram-size 2G --cpu-count 2 --disk-size 60G sierravm
vm created successfully with uuid: dfaa97c5-2154-11e8-881d-acbc32ad1d59

Then, start the VM with the sierra ISO attached.

anka start -v -o sierra.iso sierravm
| uuid                  | dfaa97c5-2154-11e8-881d-acbc32ad1d59 |
| name                  | sierravm                             |
| cpu_cores             | 2                                    |
| ram                   | 2G                                   |
| hard_drive            | 60 GB (11.2 MB on disk)              |
| addons_version        | not found                            |
| status                | running                              |
| vnc_connection_string | vnc://:admin@          |
| view_vm_display       | anka view sierravm                   |

Complete the macOS setup inside the VM. Then, stop the VM.

Start the VM again with guest addons ISO installed.

anka start -v -o /Library/Application\ Support/Veertu/Anka/guestaddons/anka-addons-mac.iso sierravm

Complete the guest addons installation inside the VM. Shutdown the VM with anka stop VMNAME.

Validate by running the following command anka run VMNAME ls -l from the host. It should display ls -l contents of the VM. The VM is correctly created.

Anka Guest Add-ons also create a default user - anka, passwd - admin for the VM.

Enabling Nested feature in the VM to run other hypervisors (Docker, Android Emulator, Anka)

With Anka 1.4.3 release, Nested support inside Anka VMs is now out of beta and GA. Nested flag can be turned on for a VM with following command.

anka modify set nested [OPTIONS] NESTED

  enable nested virtualization

  --help  Show this message and exit.

Important - For Anka VMs with nested flag enabled, the VM should be configured with a minimum of 4 vCPU, 4GB RAM. Use anka modify command to change CPU and RAM settings.

Known Issues + Currently there is a known issue that prevents upgrading Anka package when Anka VMs with nested flag enabled are in running state. Stop all VMs that have nedted flag enabled with anka stop VMName and then upgrade Anka package. + Anka VMs with nested flag enabled can only be suspended after the nested VM running the Anka Vm is shutdown. + Host machine power management sleep is disabled while Anka VMs with nested flag enabled are running.

Using .DMG file to create Anka VM

Anka comes bundled with several scripts in /Library/Application\ Support/Veertu/Anka/tools/ that assist with automation and other tasks. One script in particular,, lets you create a VM from a .dmg using the workflow example below:

Converting your AutoDMG file First convert the existing .dmg file to Anka VM.

# Change into Anka tools working directory
cd /Library/Application\ Support/Veertu/Anka/tools/

# Convert the AutoDMG-generated .dmg to an Anka VM
./ /path/to/autodmg-generated.dmg VMNAME

Starting the VM and completing the macOS installation after converting your AutoDMG image to Anka VM

Start the VM:

anka start VMNAME

| uuid                  | 67044c57-3a65-11e7-84bd-38c98630393f |
| name                  | VMNAME                               |
| cpu_cores             | 2                                    |
| ram                   | 2G                                   |
| image_id              | 48c8cb23-3a65-11e7-a2cb-38c98630393f |
| status                | running                              |
| vnc_port              | 5904                                 |
| vnc_connection_string | vnc://     |
| vnc_password          | admin                                |
| view_vm_display       | anka view VMNAME                     |

After the VM is created, anka will return standard information about the VM, including methods of access you may need. You can view the VM in the Anka Viewer application with anka view testVM or open vnc://

Manually install the guest add-ons

Once you have completed the macOS installation process, you need to manually set up the paravirtual drivers due to limitations with macOS installers. You will now configure the Anka high performance network and block driver after the macOS setup is complete.

Close the Anka Viewer application and stop the VM with anka stop VMNAME, where VMNAME is replaced with the name of your VM (ours was called testVM above). Then, attach the guest add-ons ISO using the following commands:

# Remove the existing optical drive with the .iso installer
anka modify VMNAME delete optical-drive 0

# Add new optical drive with paravirtual driver installer image
anka start -v -o /Library/Application\ Support/Veertu/Anka/guestaddons/anka-addons-mac.iso VMNAME

Install the guest add-ons inside the VM. Close the Anka Viewer and execute the following commands:

# Stop the VM
anka stop VMNAME

# Set the VM hard-drive and network to use the paravirtual drivers 
anka modify VMNAME set hard-drive --controller ablk 0
anka modify VMNAME set network-card --model anet 0

Validate by running the following command anka run VMNAME ls -l from the host. It should display ls -l contents of the host current durectory. The VM is correctly created.

The VM is now configured with Anka’s high performance paravirtual network and block drivers.

Anka Guest Add-ons also create a default user - anka, passwd - admin for the VM, which is the default user used by anka run. Start the VM, logout and login as anka user and complete the user setup process for this VM.

Instant Boot configuration for your VM

Instant availability of build and test emvironment is very critical for CI. Anka provides a way to save the VM in an Instant Start/Fast Boot Mode, before pushing it to Anka Registry for use in your CI.

Use the following command to save the VM in Instant Start mode.

# Suspend the VM
anka suspend VMNAME

Now, when you start the VM using anka start VMNAME command, it will start instantaneously. Note - Suspend the VM and then push it to Anka Registry.

Hyperthreading configuration setup for Anka VMs when running only a single instance per machine

Hperthreading flag is set at 0 by default. Set it to 1 for a VM, only if you are planning to only run a single instance of this VM on Build dual core machine node(build physical machine). If you are planning to run multiple concurrent instances of this VM, then don’t set this flag to 1.

anka modify VMNAME set hyper-threading 1

Next steps after your VM setup is complete with your project dependencies

If you have already installed Anka Registry, you can push and store this version of your Anka VM and start managing changes to this VM template with different version tags. Once the VM is pushed to the registry, you can distribute it to other machines running Anka. Refer to Using Registry section to start managing your VM templates with the registry.