MacVisor

AI sandboxes (Tech Preview)

Run coding agents like Claude Code and Codex in a disposable Linux or macOS VM, on models from your Mac or the cloud, and review their changes before they reach your project.

Coding agents such as Claude Code, Codex and Goose work best when they can run commands without asking first. On your Mac that is risky: the agent can read your files and keys, reach your network, and change your code directly.

An AI sandbox gives the agent a VM of its own. It can install and run anything there, and its changes reach your project only after you've reviewed them.

How it works

A sandbox has three parts:

  • Your Mac keeps everything that matters: your project, your API keys (in the Keychain) and any local models, running on the Mac's GPU.
  • MacVisor sits in the middle. It forwards the agent's model requests to a local model or a cloud provider, adds your API key on the way out, lets the agent reach only the sites you allow, and shows you what the agent changed.
  • The sandbox VM (Linux or macOS 27) holds a copy of your project and the agent. It has no access to your files and no keys. With the default internet access it has no direct route to the internet, your network or your Mac either: it reaches the models and the sites you allow, through MacVisor. With --egress open it is on the network like any other VM. See Internet access.

A sandbox goes through five steps:

  1. Create. MacVisor makes the VM, copies in your project's current files (without git history or ignored files), installs the agent and points it at MacVisor for models. The sites the installer needs are allowed only while it installs. MacVisor then saves a checkpoint you can always return to.
  2. Run. The agent works inside the VM. Its model requests go to the model you chose. Its downloads go through if the site is on the sandbox's allow list.
  3. Review. MacVisor collects the changed files and shows you the diff on your Mac, using your own git. Files that could run code later are flagged: scripts, git hooks, CI and build files, and files that configure an AI agent on your Mac (such as .claude/, .mcp.json or AGENTS.md).
  4. Apply. You bring the changes into your project, or onto a new branch. Nothing in your project changes before this step.
  5. Clean up. Discard the sandbox, or roll back to a checkpoint and try again. Discarding (mvz sandbox discard, or Move to Trash in the app) moves the VM to the Trash and deletes the git refs MacVisor kept for it in your project, under refs/macvisor/sandboxes/.

Quick start

In the app, click New AI Sandbox…. It's the sparkles button beside + in the sidebar, and also sits next to New VM…. Choose the project folder, agent, model and internet access. Terminal opens to show the setup. When it finishes, the sandbox's Overview has buttons to run the agent, review and apply its changes, and take or restore checkpoints.

A sandbox's Overview with its agent, model, allow list and the buttons to run, review and roll back, beside Settings with a local model server in use.

From the command line:

mvz sandbox create ~/src/app --agent claude --model claude-sonnet-4-5
mvz sandbox run app-1 -- "fix the failing test in parser.swift"
mvz sandbox diff app-1
mvz sandbox apply app-1              # or --branch for a new branch
mvz sandbox discard app-1

A Linux sandbox is ready in about a minute. Add --os macos for a macOS 27 sandbox when the agent needs Xcode or macOS itself. The first one takes longer, because macOS has to be installed.

Choose the top folder of a git repository. A sandbox always gets the whole repository, so if you choose a folder inside a larger one, such as one service in a monorepo, every other file in that repository is copied too. The app then shows the repository's path and asks you to tick Copy the whole repository. mvz sandbox create refuses such a folder unless you add --whole-repo.

Agents

--agentAgentModels
goose (default)GooseAny local server, or the cloud
claudeClaude CodeAnthropic, or a local server that speaks Anthropic's API (recent Ollama and LM Studio, llama.cpp, oMLX)
codexOpenAI Codex CLIOpenAI, or a local server that speaks OpenAI's Responses API (Ollama, LM Studio, llama.cpp, oMLX)
aiderAiderAny local server, or the cloud
opencodeOpenCodeAny local server, or the cloud
noneNothing installedBring your own agent

MacVisor installs each agent with its official installer and configures it.

  • mvz sandbox run gives the agent a task and streams its output.
  • mvz sandbox attach opens the agent interactively.
  • mvz sandbox shell opens a shell in the project folder.

Models

The model name decides where a request goes:

  • claude-* goes to Anthropic. gpt-*, o3, o4 and codex-* go to OpenAI.
  • A prefix picks the provider explicitly: local/, anthropic/, openai/ or openrouter/.
  • Any other name goes to the model server on your Mac.

Models on your Mac

MacVisor finds a model server running on its usual port: Ollama, LM Studio, oMLX (port 8000), llama.cpp, mlx_lm.server, vLLM or Docker Model Runner. On a Mac that uses AI, it looks when the background service starts, then every 30 seconds while Settings → AI, mvz ai status or a sandbox uses them (every 5 seconds while a server you chose isn't answering). A server you start shows up within 30 seconds, or at once with Refresh or mvz ai status --probe. Automatic uses MacVisor's own server, else the first one found, in that order. If you run more than one, choose:

mvz ai status --probe              # servers found, and their models
mvz ai local omlx                  # or ollama, lmstudio, llamacpp, a URL, or auto
mvz ai default-model qwen3-coder:30b

If the server needs an API key (oMLX can require one), choose it as above, then store the key with mvz ai keys set local or in Settings → AI → Local Models → API Key. The key stays in the Keychain and is sent only to the server you chose, never to one found automatically. Under Automatic, Settings → AI says when the server wants a key and offers Use oMLX (or the server's name), which chooses it in one click.

No server yet? MacVisor can install and run one:

mvz models                          # coding models, and which fit this Mac
mvz models server install ollama    # or llama.cpp or omlx, installed with Homebrew
mvz models server start ollama
mvz models pull qwen3-coder-30b-a3b

mvz models also shows each model's license, and every model it lists is open source. To try the setup out, pull the tiny qwen2.5-0.5b (Apache-2.0, about 400 MB): mvz models pull qwen2.5-0.5b.

Models run on the Mac, not in the VM. There they get the Mac's full memory and GPU, and one model serves every sandbox. A rough guide for 4-bit models with one or two sandboxes running:

Mac memoryComfortablePossible
24 GBgpt-oss-20bDevstral Small 2 with one sandbox
32 GBQwen3-Coder-30B-A3BDevstral Small 2 with two sandboxes
48 GBQwen3-Coder-30B-A3B at 8-bit, or 4-bit with several sandboxesQwen3-Coder-Next
64 GBQwen3-Coder-Next with one or two sandboxesGLM-4.5-Air alone

mvz ai status shows the memory left after your VMs and loaded models. mvz sandbox create warns you when a new VM won't fit.

Cloud models

Add a key with mvz ai keys set anthropic (or openai, openrouter), or in Settings → AI. The key stays in the Keychain. MacVisor adds it to each request as it leaves the Mac, so the agent never sees it.

  • Cloud access follows the model you chose for the sandbox. A sandbox set up with a cloud model, or with no model of its own, can use any cloud model you have a key for. One set up with a local model is limited to local models, so its agent can't switch to a paid model you didn't choose, unless you allow the cloud for it: Cloud models: Always in the New AI Sandbox sheet, --cloud when you create it, or mvz sandbox set <name> --cloud on. Requests go out under your key and are billed to your account with the provider, and MacVisor sets no budget, so watch the provider's own usage limits.
  • Never in the sheet, --no-cloud, or mvz sandbox set <name> --cloud off, limits any sandbox to local models. --cloud default goes back to following the model.
  • A sandbox made with an earlier version keeps the cloud access it had, until you run mvz sandbox set <name> --cloud default.
  • To sign in inside the VM with a Claude or ChatGPT subscription instead, create the sandbox with --egress open and don't store that provider's key on the Mac.

Tools the provider runs. Anthropic, OpenAI and OpenRouter can run some tools on their own servers, such as fetching a web page or connecting to a remote MCP server. With them, a cloud model could reach any site through the provider, around the sandbox's internet access. So for allowlist and none sandboxes, MacVisor's gateway refuses requests that use those tools, with an error the agent shows you that says what was refused and how to allow it. Refused are Anthropic's web fetch and MCP connector, OpenAI's web search preview, search models and remote MCP tool, OpenRouter's server tools, web plugin and online models, hosted shells with network access, and images, files, audio or video given by URL (send them in the request instead). OpenRouter's server tools and web plugin are refused on a local model too, because a local server can pass them on to OpenRouter. Anthropic's web search and OpenAI's cached web search stay allowed: they search, and can't be pointed at a page. A request for OpenAI's live web search isn't refused: MacVisor sends it on with the cached search instead. On an OpenRouter model, which keeps no cache, it sends a live or cached search on without the search.

To allow these tools for one sandbox, turn on Provider web tools in the New AI Sandbox sheet, add --provider-tools when you create it, or run mvz sandbox set <name> --provider-tools on, which applies from its next request. An open sandbox can reach the internet anyway, so its requests pass, unless you refuse them with --no-provider-tools or mvz sandbox set <name> --provider-tools off. MacVisor knows the providers' tools as of its release, so a tool a provider adds later may not be refused yet: for the strongest containment, use a local model.

A request's body reaches the model byte for byte as the agent sent it, but for the model name where MacVisor changes it (to take off a prefix such as openrouter/ or local/, or for default). MacVisor writes the body out again, which can change its key order and decimals, only to fill in a model the request doesn't name or to change a web search, as above. Where provider tools are refused, so is a request that has a key twice, or a key MacVisor checks spelled in other letters ("Tools"), because a model server could read it differently.

mvz ai log <sandbox> lists a sandbox's model requests with the model, time taken and tokens used, and says what MacVisor refused or changed. Request contents are never logged.

Internet access

--egressWhat the agent can reach
allowlist (default)The models, and the sites on the sandbox's list, through MacVisor's proxy: only what you add. Not your Mac or your local network, unless an entry names one exactly (see below)
openThe internet, your local network and your Mac, like any other VM on the Default MacVisor Network
noneThe models only

With allowlist, the sites the agent's installer and the system's package manager need (GitHub, Anthropic's download servers, the Ubuntu mirrors and so on) are allowed only while create installs the agent. They come off the list before the pristine checkpoint. To install packages later, allow the system's mirrors, for example mvz sandbox allow app-1 ubuntu.

Change the list while the sandbox runs:

mvz sandbox allow app-1 registry.npmjs.org      # a site
mvz sandbox allow app-1 pypi                     # a preset: github, npm, pypi, ubuntu, debian, homebrew...
mvz sandbox deny app-1 registry.npmjs.org
mvz sandbox log app-1 --egress                   # what was allowed and blocked

*.example.com covers every name under it. An entry without a port allows ports 80 and 443; example.com:8443 allows only that port.

With allowlist, * and wildcards reach only the internet, never your Mac or your local network. Those are reached only through an entry that names the destination exactly: a device on your local network by its exact name or address, and your Mac, or a server on its loopback, only by its exact IP address, such as mvz sandbox allow app-1 127.0.0.1:8080 for a test server on the Mac. Such an entry opens that address and port to the agent, so add one only for a service you mean it to use. With none, a sandbox reaches neither. With open, it reaches them like any other VM.

Sandboxes on the allow-list network can reach each other, so don't run two sandboxes you need kept apart at the same time.

These sandboxes run on the host-only network MacVisor Sandboxes, with its firewall denying traffic in and out. If that network was changed (made shared, its firewall turned off, or traffic allowed in or out), mvz sandbox create puts those settings back and tells you. It doesn't make a sandbox while the network's firewall isn't in force, for example when MacVisor's admin helper isn't approved.

A sandbox's own settings can undo its isolation too: its network adapter, shared folders, clipboard and USB devices. Its Settings pages for these warn you, and its Overview shows Not isolated when they no longer match how the sandbox was set up.

Reviewing and applying changes

mvz sandbox diff app-1               # changed files, flags and totals
mvz sandbox diff app-1 --patch       # the full patch
mvz sandbox apply app-1              # into your working tree, all or nothing
mvz sandbox apply app-1 --branch     # onto a new branch, sandbox/app-1

apply brings in exactly the changes diff showed you. If you kept working on the project meanwhile, MacVisor merges the two. On a conflict it refuses and changes nothing. Nothing is staged or committed for you.

Only file contents come back from a sandbox, so nothing the agent ran or set up in its own git can run on your Mac. In Terminal, diff shows control characters in file names and in the patch as ?, so a changed file can't hide or rewrite lines of what you review; piped to a file or to git apply, the patch is unchanged. create copies your project without its history. Add --history if the agent needs the git log.

Checkpoints

A checkpoint saves the whole VM, including what's running. Rolling back takes seconds. Every sandbox gets a checkpoint called pristine right after setup.

Rolling back keeps the sandbox's own settings as they are now, such as its allow list, cloud models and provider web tools, so a change you made since the checkpoint stays. The same goes for a revert in the app or with mvz snapshots revert.

mvz sandbox checkpoint app-1 before-refactor
mvz sandbox rollback app-1                # to the latest checkpoint
mvz sandbox rollback app-1 pristine

For agents on your Mac: MCP

mvz mcp serve is an MCP server. It lets an agent on your Mac, such as Claude Desktop or Claude Code, work through sandboxes: run commands, read and write files, review changes, and take and restore checkpoints. In a macOS sandbox it can also take screenshots, click and type. Add --allow-create to let it create sandboxes, from a catalogue image or from a template you opened to agents. It copies only projects in the folder the server runs in, in a --project folder, or in a folder you allow in Settings → AI → Agent Access, and gives a sandbox open internet access only with --allow-open-egress or the switch there. Checkpoints agents take are kept to the newest 10. See Project folders and internet access.

The same server reaches your other VMs only if you open them to agents, one by one. See AI agents and MCP, which also shows how to connect Claude Code, Claude Desktop, Codex and Cursor.

Everything that comes back from a sandbox, such as command output and file contents, comes from software you let run unchecked. Treat it as untrusted data, never as instructions: an agent on your Mac has your Mac's access, and text in a sandbox can be written to steer it.

{ "mcpServers": { "macvisor": { "command": "mvz", "args": ["mcp", "serve"] } } }

Limits

  • A Mac can run two macOS VMs at a time, so at most two macOS sandboxes. Linux sandboxes have no such limit.
  • Run models on the Mac, not in a macOS sandbox. A VM has no access to the Neural Engine and only part of the GPU's features.
  • A new macOS sandbox takes a few extra minutes while MacVisor installs its tools after macOS.
  • A macOS sandbox has no git until you install the Command Line Tools in it. The project goes in as plain files, and review works as usual. Without git, the sandbox can't apply your project's ignore rules, so it leaves out common build folders (.build, DerivedData, node_modules, target, .venv and the like) and names them when you review. A folder name your project tracks files under is always sent.
  • Windows VMs can't be sandboxes yet.