Build cache for faster iOS builds with Jenkins CI and on-demand macOS VM slaves

Most of the existing iOS CI environments are configured to run the build and tests jobs directly on the Mac hardware. In such installations with large projects, some data like XCode derived data, and code repository get cached on the hardware and subsequent builds use these caches. In this blog, we will describe how you can set up your Anka Build macOS cloud in a Jenkins CI environment to build cache inside the VM and use them for on-demand provisioned Jenkins iOS CI slaves. This will provide the advantages of isolated, reproducible environments and build caches for faster build times.

We have implemented a Jenkins plugin called “Anka Slave template Prepare” plugin. This plugin enables devops to load and update build cache on existing jobing Anka macOS VM templates in an automated manner. Devops can then use the Anka Build Cloud Jenkins plugin and setup their primary iOS CI Jenkins jobs to always run using the VM templates pre-loaded with caches.

Visit for detailed documentation to configure the plugin.

Anka Slave Template Prepare Jenkins Plugin

Post Build Action Configuration

Run docker workloads in macOS VMs on Anka Build – DevOps Uploaded

There is “Lunchable,” and then there is “Lunchable Uploaded”. Today, we are announcing nested beta support in Anka Build platform to run Docker workloads in macOS VMs. It takes DevOps up a notch for macOS ecosystem. So, why nested support in Anka? Nested for everyone who is familiar with virtualization, means to run a hypervisor inside of a virtual machine. In Anka Platform, this means that you can run docker workloads(container) in Anka macOS VMs. Docker on macOS uses xhyve virtualization and now, with nested support you can run xhyve hypervisor inside Anka macOS VMs.

In the past few months, we have received a lot of user feedback on use cases to build macOS CI infrastructure which can also support nested workloads on macOS, in addition to the traditional iOS app and macOS app CI. We think of nested support as providing infrastructure to build and test infrastructure for macOS (think Russian nesting dolls).

So, everyone who is building apps for macOS which uses a hypervisor layer in their application stack can now configure a private macOS cloud for CI and provision on-demand macOS environments for build and tests. Example, folks at Docker might find this interesting to build CI infrastructure for their Docker macOS client, security software macOS clients who use a virtualization layer in their stack could use this to configure CI infrastructure and probably many more use cases.

We would love to learn and engage with all of you who want to look at this beta feature. Send us an email at, tweet us (@veertu_labs) or connect with us on slack.

iOS simulator tests in macOS VMs – XCUITest simulator tests on Anka Build macOS Cloud

There is some confusion about the feasibility of executing iOS simulator based UI testing in macOS VMs. Anka macOS VMs provide pretty much all capabilities of macOS running on hardware to set up a scalable, agile CI infrastructure for building and testing iOS applications. Since iOS simulator uses software-based rendering for graphics, it can run and execute all UI and non-UI based testing inside Anka VMs.

We have detailed steps to set up and run iOS builds and tests in Anka Build macOS cloud our blogs. Here is a quick summary of these steps – Setup Anka Build on a cluster of mac build machines, bootstrap your test Anka VM template with all relevant test framework dependencies, push this VM template to the Anka Registry and integrate Anka Build Controller to communicate with your CI tool.

When you execute iOS simulator test jobs in your CI tool, the job will automatically provision multiple isolated, concurrent macOS VMs from the uploaded VM template and execute UI test jobs. The VMS can be configured to be deleted after the job or kept alive for troubleshooting purposes. Every execution of the UI test job provisions new VMs, hence there is no leakage of any environment variables or dependencies and the UI tests run in a predictable manner.

View a demo of XCUITest execution in dynamically provisioned concurrent Anka Build VMs –

Container like ‘anka run’ interface for Anka macOS VM

Anka run command line interface enables command execution inside Anka macOS VMs directly from the host. It’s very similar to container docker run.

Why is this interesting – It allows Devops to take their existing container based Linux CI workflow automation, repurpose it for macOS and use it on Anka Build macOS Cloud infrastructure for iOS CI.

anka run --help

Usage: anka run [OPTIONS] VM_NAME COMMAND [ARGS]...

Run commands inside VM environment


-w, --workdir PATH Working directory inside the VM [optional]

-v, --volumes-from, --volume PATH Mount host directory (current directory by default) into VM . '--volumes-from' is deprecated form [optional]

-n, --no-volumes-from, --no-volume Use this flag to prevent implicit mounting of current folder (see --volume option). '--no-volumes-from' is deprecated form [optional]

-E, -e, --env Inherit environment variables. '-e' is deprecated form [optional]

-f, --env-file PATH Provide environment variables from file [optional]

-N, --wait-network Wait till guest network interface up [optional]

‘anka run’ by default mounts the current folder from the host into the Anka macOS VM and executes commands on this mount point as the current directory. Upon completion of command execution, the mount directory is automatically released. As a developer, this can be quite useful to be able to execute operations inside the VM environment in an isolated manner using artifacts/code residing on the developer machine. Example,

anka run xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build

–volume (-v) – Mount directory into VM. Mountpoint could be specified explicitly in this form:–volume /host/dir:/mountpoint, or assigned dynamically: –volume /host/dir. If no –workdir option is specified, mountpoint will be selected as working directory for running command.

Example : anka run -v ~/Projects/anka:/tmp/anka run build

–no-volume (-n) – By default anka run command mounts current directory into VM, (implicit –volume $PWD option). Specify this option to disable implicit mounting. If no –workdir option is specified, working directory will be set to VM user’s home directory.

Example :

anka run -n xcodebuild -sdk iphonesimulator -scheme Kickstarter-iOS build - Will not mount the current host directory and execute build in the VM current directory.

–workdir (-w) – Specify working directory inside the VM

Example :

anka run -n -w /tmp/workspace/project git clone ${URL} src

anka run -n -w /tmp/workspace/project/src xcodebuild

–env (-E) – Inherit host environment variables in non-overriding mode. Example : CFLAGS=-O2 CC=clang anka run -E ${VM} make test.c

–env-file (-f) – Provide environment variables in overriding mode from file specified. Format of the environment file can be:



–wait-network (-N) – Resumed VMs require some time to reconfigure networking interface, so scripts which use networking immediately (e.g: git clone) could fail on network inaccessibility. This option postpones execution of the command till network is up. Incorporate it in your VM bootstrapping automation before starting to access network from inside the VM.

Scaling iOS CI infrastructure with Anka Build

You start with one iOS app and then it morphs into multiple apps, and you are shipping a new version of all these apps frequently to the app store without compromising on quality. How do you do it?

First, you build an application architecture that supports the scale – a large team of developers working on same codebase and flexibility and ability to expose new features quickly to the users. Then, you invest in test automation to have multiple sets of tests for different workflows and features in your app. And, you invest in CI and CD infrastructure that eliminates wait times for developers between builds, faster feedback from tests and quick deployment to the app stores.

In this blog we will focus on how you scale and manage iOS CI build/test infrastructure to support a high velocity of development and increased code quality for releases.

We see users adopting one of three approaches to address the scale challenge of iOS CI infrastructure and introduce a new method outlined in Option 4.

Option 1 – Increase the bare metal mac hardware capacity for build and test machines

This results in increased hardware costs, but also means significantly higher system management overhead. Devops and system management team need to plan for additional complexity in build and test environment configuration management across all the hardware, capacity planning and sharding strategies to test concurrently on multiple versions of application dependencies. Due to imaging-based approach, repeated set of these operations on the same hardware also results in stability issues.

Option 2 – Consuming hosted CI iOS build services

These services are provided as multi-tenant/shared basis and in most cases unable to meet the extensive scale requirements of a single user. Additionally, there is an exponential increase in cost as the usage goes up. You are no longer in the lowest/cheapest service tier but have to move to a custom tier.

Option 3 – Scaling with legacy based virtualized infrastructure

There are some supported and(some unsupported) approaches to set up a virtualized infrastructure on top of Mac hardware which can be used to spin up iOS build and test environments on-demand. The underlying technology to virtualize in such case uses a shared storage infrastructure to support scale(more than one host). With base VM images stored as snapshots in shared storage, new instances of a VM and all the build and test job IO operations execute on shared storage infrastructure. This places extremely short response times demands on shared storage and can only be achieved at a very high cost, low latency shared storage architecture. As you scale up this infrastructure, the prices for shared storage increases exponentially. The long-term TCO of should be considered before starting with this option.

Option 4 – Setup cloud/virtualized infrastructure which can scale linearly and operates as infra-as-a-code.

The concept of containers bring this concept to Linux and Windows infrastructure; however, it’s not yet possible to run macOS inside a container. Anka Build virtualization uses macOS native hypervisor framework to create and run lightweight macOS VMs. Similar to container provisioning, it provides provisioning of macOS environments from ‘’ package in a fully programmable manner. Anka Build Cloud exposes features to store, version and manage multiple macOS images in a central registry, similar to container registry and also provides a programmable interface to pull and push these images across various host mac machines. Once the image is pulled on a Mac host machine, immutable VMs on-demand are provisioned by cloning the already pulled image and deleted after the build/test job execution. There is no need for a shared storage architecture attached to each mac host. Additional mac hosts can be added to an existing Anka Cloud setup linearly to scale the CI iOS infrastructure with minimal effort.

Get more details on Anka Build macOS Cloud architecture and registry setup at

macOS VM image management in Anka Build – macOS cloud solution

Anka Build from Veertu is a complete software solution to configure a macOS cloud on a cluster of Mac hardware (on-prem or hosted) and run macOS VMs like you would run containers.

If you use container based CI setup, you can take the same DevOps process and implement them for CI on macOS for your iOS apps. Alternatively, if you are more used to working with VMs, you can work with Anka VMs in a similar fashion. Anka Build solution supports both methods for DevOps.

Anka macOS VM is created, virtualized and run on top of Anka virtualization technology running on each mac hardware node. In this blog, we will describe the image structure of Anka macOS VM and image management strategy in Anka Registry component.

Creating macOS VM

Use `anka create` method to create a VM with base macOS. While using `anka create` you can specify the disk size for your VM using the `-d` or `–disk-size` parameter. This is not reserved capacity but the total maximum VM hard drive capacity. As you install additional software inside Anka macOS VM, the disk size gets allocated dynamically.

Execute `anka show VM` to look at actual hard drive size.

Anka Show

Anka Show

Cloning Anka VMs

`anka clone VM1 VM2` creates a snapshot file pointing to the parent VM1. Any more changes to VM2 are made only in the snapshot and is still pointing to the parent VM1. The parent VM1 can be changed and/or deleted, but the clone VM2 will stay unaffected. When both parent and clone exists, since the clone is not completely duplicated, the overall disk space is optimized.

Stopping and Suspending Anka VMs

Anka optimizes VM disk space usage on every stop and suspend operation by going over the entire file system and freeing up unclaimed blocks.

Managing Anka VM versions of Anka Registry

You can incrementally install software components on base macOS VMs and maintain versions in Anka Registry. At any time, you can pull an older version of a VM from the Registry.

Anka registry commands

Anka registry commands

Anka VM image hierarchy management

Anka VM image hierarchy management diagram

Anka VM image hierarchy management diagram

Anka VM image and version management are built to optimize disk space usage on the Mac nodes running the VM and also data transfer times when pushing and pulling the VMs on the Mac nodes.

Bootstrapping Anka macOS VM for your iOS Build/Test Job

What is Anka Build

Anka Build is a solution suite to configure a macOS cloud mac hardware, on which you can provision immutable docker like macOS VMs for iOS and macOS CI jobs. Anka hypervisor enables macOS VMs to run in a very resource efficient manner and fast boot feature makes them available on-demand instantly. Anka controller and registry modules provide a simple method to set up a scalable macOS cloud and integrate with third party CI systems.

Anka command-line interface enables you to bootstrap and prepare your macOS VMs in a dockerfile like fashion, for CI build and test jobs.

In this blog, we will look at how you can start to manage your macOS CI infrastructure as a code. Part 1 of this blog will focus on creation and bootstrap your macOS build/test environment that you can use a VM template to provision simple, fast, immutable elastic docker like slaves/agents.

Step 1 – Install AnkaBuild.

Install ankabuild.pkg on your mac and activate license (sudo anka license activate key). You can automate the installation and activation steps.

Step 2 – Create macOS VM. Build a macOS VM running a specific version of macOS, hard drive allocation, CPU, and RAM. You can also modify CPU and ram settings later.

anka create --ram-size 4G --cpu-count 2 --disk-size 45G --app /Applications/Install\ macOS\ High\ myhisierravm


Step 3 – Install Toolkits in the macOS VM.

Use ‘anka run’ to work inside the newly created VM and install dependencies like Xcode etc to prepare your VM for iOS build/test. Anka run is similar to docker run. When you execute ‘anka run’ against an Anka VM, it executes in an isolated manner inside the VM, separate from the host.

Step 3.1 – Install brew, homebrew in Anka macOS VM.

Just execute command, provided on the site, but with ‘anka run’ to install brew inside the Anka VM.

anka run -n myhisierravm ruby -e "$(curl -fsSL"


Step 3.2 – xcode-install in Anka macOS VM.

Execute xcode-select tool command with ‘anka run’ to install it inside the Anka macOS VM.

anka run -n myhisierravm sudo gem install xcode-install


Step 3.3 – Complete Xcode setup in Anka macOS VM.

FASTLANE_PASSWORD='passwd' FASTLANE_USER='usr' anka run -nE myhisierravm xcversion list

Note : -n option of anka run prevents implicit mounting of current folder inside the VM.

-E enables inheriting env variables (eg : FASTLANE variables) in the Anka macOS VM.

FASTLANE_PASSWORD='passwd' FASTLANE_USER='usr' anka run -nE myhisierravm xcversion install 9.2


In some scenarios, it might not be best to provide credentials directly in shell command line (saved history, etc). To secure FASTLANE_ variables, you could store them into a text file (fastlane_cred.txt) in the following form.

  • Then populate the Anka VM environment from the file (with -f | –env-file option).

    anka run -nf fastlane_cred.txt myhisierravm xcversion install 9.2

    Step 4 – Xcode setup is now complete inside Anka macOS VM.


    Step 5 – Mount provisioning profiles from host inside the VM.

    anka mount myhisierravm ~/Library/…/Provisioning\ Profiles /Users/anka/Library/…/Provisioning\ Profiles

    This will make provisioning profiles accessible inside the VM for Xcodebuild.

    Step 6 – Execute Xcodebuild for your project inside the Anka macOS VM.

    anka run myhisierravm xcodebuild test -scheme Kickstarter-Framework-iOS -destination 'platform=iOS Simulator,name=iPhone 8,OS=11.2'

    Note : This command mounts the existing current folder from the host into the VM and executes Xcodebuild on it. Because we mounted provisioning profiles in the previous step to a specific default Xcodebuild location inside the VM, the above command will use those mounted provisioning profiles without the need for any configuration change inside the VM.

    Refer to anka run command line help for additional details.


    In the next blog in this series, we will share how to setup and manage the Anka Build macOS CI cloud with command line/Infra as a code. Stay tuned.

    Anka Build Controller Portal – Provides visibility into the health of macOS cloud for CI

    In our recently released version 1.2 of Anka Build, we made few changes to the management module (Controller) to enable even easier setup, configuration, and management of macOS cloud for CI. For more details on how to configure macOS cloud for CI, refer to Anka Build macOS cloud on Mac Pro or Anka Build macOS cloud on Mac Minis.

    Anka Build Controller and Registry module are packaged in a single download package. These components install as Ubuntu Docker containers and can be either installed on the same machine/instance or on different machines. Refer to this link for more details.

    Registry configuration involves defining a volume to store the VM images and pointing to that in the docker-compose.yml.

    volumes: - `/Users/administrator/Desktop/registryvm:/mnt/vol`

    Note – Make sure to not setup the volume in the same directory where the registry/controller containers are running.

    Controller configuration involves editing the anka.controller.docker to point to the registry IP address.


    Once you have setup controller/registry containers, access the new web-based portal at http://controllerip:8090.

    Dashboard View

    This view displays a single pane view into the current state of your Anka Build macOS cloud. You can see the total no of Anka Build nodes(mac machines which have Anka Build installed and are joined to the controller), the total number of macOS VM instances running, total available storage in the registry and available capacity to run additional macOS VM instances.

    The template usage pie chart displays all current VM templates that are being used to provision VM instances.

    Average resource usage across all active nodes displays the CPU and RAM usage across all nodes for the entire Anka Build macOS cloud.

    Dashboard View

    Nodes View

    This view displays all the mac build/test host machines running Anka Build software package and are joined to the controller.

    Node View

    Templates View

    This view displays all the VM images and their corresponding tags/versions stored in Anka Build Registry.

    Through this view, you can also distribute/pre-populate VM template images to all your Anka Build nodes for faster first time provisioning.

    Templates View

    Distribute to nodes

    Instances View

    This view displays all running macOS VM instances at any given point in time.

    Use Create Instance to manually create macOS VM instances on the cloud. Use this feature for manual troubleshooting.

    Instances View

    Create Instance

    iOS CI infrastructure – macOS cloud on Mac Pros with Anka Build

    In our previous blog post, we discussed setting up macOS cloud for iOS CI on a mac mini cluster. Let’s now look at creating macOS cloud on mac pros for scalable and agile iOS CI. While the CPU on mac minis are much faster(as proven in various benchmarks) than existing Mac Pro models and result in a much high performing macOS cloud for iOS CI, there is still a great deal of interest in setting up iOS CI infrastructure on Mac Pros. Let’s look at how you can use Anka Build technology to very quickly set up and efficiently manage a scalable and agile macOS cloud on Mac Pros. One of the cool things about Anka Build virtualization technology is that it’s built on top of macOS Hypervisor framework and supported on all the Mac hardware. You can configure your iOS CI infrastructure on Mac minis, Mac Pro, iMac Pro, MBP or a combination of these. Download 30 Day trial at

    Installing and configuring macOS cloud on Mac Pro cluster

  • Anka Build.pkg – This is a mac application package and installed on each of the Mac Pros.
  • Anka Build Controller and Anka Build Registry – This is a docker container package and installed in a VM or an AWS instance. If you set up your Mac Pros in Macstadium, you can set up and run controller and registry modules in a VM in Macstadium.

  • Hosted Anka Build Cloud can be secured entirely with VPN based connectivity between on-premise CI and hosted Anka Build controller. If you are using Macstadium, chat with their sales support to get more details on this.

    Step 1 – Install AnkaBuild.pkg on the Mac Pros. Check out Getting Started here.

    Step 2 – Install Anka Controller.

    Step 3 – Install and configure Anka Registry.

    Step 4 – Create macOS cloud by joining each Mac pro(running Anka Build) to the controller. Use ‘ankacluster join’ command.

    Step 5 – View your macOS cloud from controller management portal (this module is not available in the current version). We are providing a sneak peek into this controller portal through this blog. It will release in Anka version 1.2 upcoming release.

    Controller Anka Build macOS cloud dashboard showing overall health

    2 node Mac Pro macOS cluster

    Step 6 – SSH or VNC into one of the Mac Pros(running Anka Build). Let’s call this the builder mac. Create your macOS VM iOS build and test iOS environment (Anka VM Templates). Full command line support is available (‘anka create’) and you can fully automate this step (‘anka create’ & ‘anka run’). In this demo, we are creating a VM with 4vCPU, 8GB RAM and all dependencies to build and test the Kickstarter iOS project. You can change VM settings (CPU, RAM, etc.) with ‘anka modify’ command.

    macOS Hisierra Anka VM created on macOS Hisierra Mac Pro

    Step 7 – Connect the builder Mac Pro to Anka Registry and push the prepared VM template to this central private macOS cloud registry. You can tag (version) and use it as a base VM to create new environments(with different tags) and store and manage them in the registry.

    Latest tagged version of Hisierraga VM template in the Registry

    Step 8 – If you use Jenkins for your CI, install the Anka Build Jenkins plugin. For any other CI system, use the controller REST APIs to integrate. If you use hosted CI services like Buildkite or Gitlab CI, contact us to get additional details on integration. Check out details on Jenkins plugin here.

    Step 9 – Check the health of all Anka Build components in the controller portal.

    Step 10 – Let’s do a test run. I will launch multiple macOS VMs on my 2 Mac Pro node macOS Anka Build cloud.

    Manually creating on-demand VMs

    On-demand launched Anka macOS Vms on Anka Build cloud

    Step 11 – Now, let’s create a real job queue in Jenkins to run on this multi-node Mac Pro Anka Build cloud. Jenkins Anka Build plugin instantly launches clean VMs on the Anka Build cloud, and when the build job finishes, the VM dies. Next job starts a fresh VM.

    Kickstarter iOS project jobs in Jenkins

    Automatically launched clean Anka VMs from Jenkins

    Jenkins job running in Anka VMs

    On-demand clean Anka VMs launched automatically for Kickstarter Jenkins Jobs

    Every iOS CI build or test job request instantly gets a clean, consistent macOS VM environment. Test new versions of Xcode, iOS SDKs by creating new tagged Anka VM from a base template, manage them in the registry and use them for your CI jobs. Scale up the capacity by easily adding additional Mac Pros to the existing Anka Build cloud cluster.

    Configuring Jenkins Pipeline for iOS CI to run on Anka Build macOS cloud

    In this blog, we will describe steps to run Jenkins iOS CI jobs defined as pipelines on macOS slave VMs running on Anka Build Anka Build macOS cloud. One of our previous blog titled “configuring Jenkins iOS CI macOS cloud” covered the basic steps to configure Jenkins-Anka Build plugin and steps to use it in Jenkins iOS CI jobs defined through web UI. Jenkins pipeline provides an extensible set of tools for modeling simple-to-complex delivery pipelines “as code” via the Pipeline Domain Specific Language (DSL) syntax. When using it in combination with Anka Build macOS cloud, the steps are relatively straightforward.

    Step 1 – Install and setup Anka Build Jenkins plugin.

    Step 2 – Set Anka Build macOS private cloud IP details in the plugin.

    Step 3 – Create Anka macOS VM Slave templates to use for your iOS CI jobs. In this step, you will define a label for each of these slave templates.

    ANka Build plugin Slave template

    Step 4 – Define your Jenkins pipeline – This example is a simple pipeline definition which executes Build and Test scripts/actions. The pipeline launches Anka macOS VMs (Jenkins slaves) on-demand on Anka Build cloud as per the label definition.

    Sample Jenkins Pipeline Job

    Using Anka Build Slave template label in Pipeline definition

    Step 5 – When this pipeline executes, it launches one or multiple macOS VMs on-demand for job execution. Every build and test job gets a sterilized, consistent environment.

    Pipeline jobs executing on Anka Build macOS cloud

    If you are using other declarative CI tools or platforms like Gitlab CI or Buildkite, you can use anka command line tool interface for easy integration with agents/runners. In such scenarios, the agent/runners running on macOS hosts will be able to launch on-demand Anka macOS VMs from templates (pulled from Anka Registry) , to fulfill job requests. We will be covering these scenarios in our upcoming blogs.