← All posts

Tart: The Comprehensive Guide to macOS Virtualization on Apple Silicon

Date: 2025-11-24 Tags: Virtualization, macOS, DevOps, CI/CD Author: Wissam Ztaoui


Introduction

Tart is a virtualization toolset designed specifically for Apple Silicon (M1/M2/M3) chips. Developed by Cirrus Labs, it leverages Apple’s native Virtualization.Framework to provide near-native performance for macOS and Linux virtual machines. Unlike traditional hypervisors (VirtualBox, VMware), Tart is lightweight, CLI-first, and optimized for CI/CD pipelines and ephemeral environments.

This guide covers installation, VM management, networking, and advanced configuration.


1. Installation

Tart is distributed via Homebrew. Ensure you have Homebrew installed and updated.

# Install Tart and the softnet networking daemon
brew install cirruslabs/cli/tart

Verify the installation:

tart --version

2. Managing Virtual Machines

Cloning an Image

Tart uses an OCI-compatible registry model (similar to Docker) for distributing VM images. You can clone pre-built images directly from GitHub Container Registry.

# Clone the latest macOS Sonoma image
tart clone ghcr.io/cirruslabs/macos-sonoma:latest my-sonoma-vm

Running a VM

To start a virtual machine in GUI mode:

tart run my-sonoma-vm

To run in headless mode (no GUI), which is useful for background tasks or SSH access:

tart run --no-graphics my-sonoma-vm

Deleting a VM

To remove a local VM and free up disk space:

tart delete my-sonoma-vm

3. Configuration & Customization

CPU and Memory Allocation

By default, Tart allocates resources based on the image configuration. You can override these at runtime.

# Run with 4 CPUs and 8GB RAM
tart run --cpu 4 --memory 8192 my-sonoma-vm

Disk Resizing

To increase the disk size of a VM (e.g., adding 20GB):

tart set my-sonoma-vm --disk-size +20

Note: You may need to resize the partition inside macOS using Disk Utility after booting.


4. Networking

Tart provides two networking modes: NAT (default) and Bridge.

Port Forwarding (NAT)

To access services running inside the VM (e.g., SSH on port 22) from your host machine, use the --dir flag to map ports.

# Map host port 2222 to VM port 22
tart run --dir "2222:22" my-sonoma-vm

You can now SSH into the VM:

ssh admin@localhost -p 2222

Bridged Networking

For the VM to appear as a distinct device on your local network (receiving its own IP from your router), use the --net-bridged flag.

tart run --net-bridged="en0" my-sonoma-vm

Replace en0 with your active network interface.


5. Mounting Directories

To share files between the host and the VM, Tart allows mounting host directories.

# Mount the current directory to /Volumes/MyShare in the VM
tart run --dir ".:/Volumes/MyShare" my-sonoma-vm

6. Automation & CI/CD

Tart is designed for ephemeral usage. You can run a VM, execute a script, and discard changes immediately.

# Run a script and exit
tart run my-sonoma-vm --script "echo 'Hello from VM' > /Users/admin/hello.txt"

For CI/CD (e.g., GitHub Actions, GitLab CI), Tart integrates seamlessly to spin up fresh environments for every build, ensuring consistency and isolation.


Conclusion

Tart represents the modern standard for macOS virtualization on Apple Silicon. Its speed, scriptability, and integration with the OCI ecosystem make it a superior choice for developers and DevOps engineers alike.


← Back to all posts