Run AI coding agents in a macOS, Linux or Windows virtual machine on your Mac.

Claude Code and Codex work fastest with approvals off. In a Hangar VM they can’t touch the files on your Mac, they can only connect to the websites you allow, and one command undoes everything they did.

$ brew install --cask baseguard/tap/hangar
  • Free and open source (Apache 2.0)
  • macOS 27 or later
  • Apple silicon

Hangar is a Mac app and a command line.

Every VM in one window: its screen, its processor, memory and disk use, and every connection it makes. The hangar command line works on the same VMs.

Hangar's window in front, showing a running macOS VM's processor, memory, disk and network use. Behind it, the windows of a Windows 11 VM, a Linux VM and a macOS VM.

Without Hangar, with Hangar

Agent on your Mac, approvals off

  • Your files
    It can read and change all of them
  • Your SSH keys, cloud keys, browser
    Within reach
  • Internet
    It can connect anywhere
  • Your API tokens
    Sitting in files and environment variables
  • If it deletes or breaks something
    It’s gone

Agent in a Hangar VM, approvals off

  • Your files
    It sees only the folder you share
  • Your SSH keys, cloud keys, browser
    Not in the VM
  • Internet
    Only the sites you allow
  • Your API tokens
    Added outside the VM, only for the sites you choose
  • If it deletes or breaks something
    Restore the snapshot

How is Hangar different from Docker, OrbStack or VirtualBox?

Docker and Podman

Containers run only Linux, and share one kernel. Keeping a container to a few websites means building your own network and proxy. Hangar gives each agent a whole VM, macOS, Linux or Windows, with the allow list built in.

OrbStack

Fast Docker and Linux machines on a Mac. It doesn’t limit which websites a machine can reach, or log its connections. Hangar does both from outside the VM, where the agent can’t switch them off, and runs macOS and Windows too.

VirtualBox and other VM apps

General-purpose VMs, made for people, not agents: no allow list for websites, no log of connections, no way to give a VM API keys it never holds. Hangar has all three, and a command line and MCP server for the agent to use.

Compare Hangar with Tart, Docker Sandboxes and NVIDIA OpenShell

See every connection the VM makes

Hangar records every website the VM looks up and connects to, how much data went each way, and what was blocked. It does this from your Mac, outside the VM, so nothing running inside the VM can hide its connections or turn the recording off.

$ hangar traffic kestrel --follow
A macOS VM's Traffic tab: every connection it made, with the time, host, address, protocol and bytes sent and received.

Allow only the websites you choose

Turn on an allow list, and the VM can reach only those sites. Changes apply immediately, even while the agent is working. Blocked connections are marked in red.

$ hangar policy kestrel --mode allowlist --allow anthropic.com --allow claude.ai --allow github.com
# cut the VM off from the internet at once:
$ hangar policy kestrel --isolate on
A Debian VM's Traffic tab with an allow list on: github.com, registry.npmjs.org and api.anthropic.com get through; pypi.org, example.com and an NTP server are blocked.

Use API keys without putting them in the VM

Store a key in Hangar and it stays in your Mac’s Keychain. Inside the VM, the environment variable holds a fake value. When the VM sends a request to a site you chose, Hangar replaces the fake value with the real key on the way out.

In the VM
GITHUB_TOKEN=hangar…
Hangar, on your Mac
puts in the real key
api.github.com
gets the real key
The Add a Secret window: hosts api.github.com, name GITHUB_TOKEN, header Authorization, prefix Bearer. The value goes to the Mac's Keychain only.

Undo everything with snapshots

A snapshot saves the VM’s disk as it is right now. Taking one is instant. Restoring it throws away every change made since.

$ hangar snapshot take kestrel clean
$ hangar snapshot restore kestrel clean
A VM's Snapshots tab with one snapshot and its menu: New VM from Snapshot, Restore, Rename, Export, Show in Finder and Delete.

Run several agents at once

Make copies of a VM from a snapshot. Each copy is a separate VM with its own network address.

$ hangar clone kestrel kestrel-2 --snapshot clean
$ hangar clone kestrel kestrel-3 --snapshot clean

Let Claude Code or Codex create VMs for you

hangar mcp is an MCP server. Add it to Claude Code or Codex on your Mac and ask in plain words. The agent can create and start VMs, run commands in them, copy files, take snapshots and change which sites a VM can reach. It can’t delete VMs, and it never sees your keys or passwords.

$ claude mcp add hangar -- hangar mcp
$ codex mcp add hangar -- hangar mcp
“Create a Debian VM with Go installed that can only connect to github.com.”
create_vmgo-dev · Debian
run_commandapt-get install -y golang
traffic_policyallow list: github.com

macOS, Linux and Windows

Three VMs running side by side on one Mac: Windows 11, macOS and Linux.

macOS

Ready-made images (plain, with Homebrew, or with Xcode), or any macOS version from Apple.

Linux

Ready-made Debian and Ubuntu images, any installer ISO, or your own image.

Windows 11

Microsoft’s ISO for Arm. Hangar installs it without you clicking through the setup.

Other features

Browse the VM’s files

A Finder-like window on a running VM’s disk. Drag files in and out.

Hangar's file browser showing a Debian VM's disk.

Connect USB devices

Hand a device plugged into your Mac to a running VM.

The Virtual Machine Accessories list: USB devices plugged into this Mac.

A private network for your VMs

Every VM gets its own address. Nothing is bridged to your local network.

Hangar's Network page: its subnet, this Mac's address, and the address of each VM.

Run commands without SSH

Run a command in a running VM, or copy files in and out, through Hangar’s agent in the VM.

$ hangar exec kestrel uname -a
$ hangar cp report.pdf kestrel:/home/admin/
$ hangar cp kestrel:/var/log/app.log .

Install

Download the app, or install it with Homebrew. Then turn on the command line in Hangar’s settings.

Prefer the app? Press ⌘N, pick macOS or Linux, and click Create and Start.

$ brew install --cask baseguard/tap/hangar
# a Debian VM, running in the background
$ hangar create kestrel --os linux --image debian
$ hangar run kestrel --background
# open a shell in it, and install your agent
$ hangar exec -it kestrel bash
# then allow only what it needs
$ hangar policy kestrel --mode allowlist --allow anthropic.com --allow claude.ai --allow github.com

Download Hangar

Free and open source under the Apache 2.0 license. Needs macOS 27 or later on a Mac with Apple silicon.

Download for Mac