---
title: "Platform Backends"
seo:
  description: "isolate has one backend: Apple Containerization on macOS 27+ Apple Silicon. There is no backend selection; unsupported operations fail explicitly."
---
<!--
Derived from trailofbits/coop.
Modified by chr33s: ported/adapted for the Swift implementation.
SPDX-License-Identifier: Apache-2.0
-->


> **Host support:** This fork supports macOS 27+ on Apple Silicon only. Linux
> guests remain supported.

isolate has one backend: Apple Containerization on macOS 27+ Apple Silicon. There
is no backend selection; unsupported operations fail explicitly.

## macOS / Apple sandbox

The host CLI is built from the root Swift package (`swift build`, or
`python3 scripts/build-release.py` for the full archive). **iso-sandbox** is isolate's runtime on Apple's
[`containerization`](https://github.com/apple/containerization) package
([`iso-sandbox`](https://github.com/chr33s/iso/tree/main/iso-sandbox)).

Each instance is one Linux VM running systemd from its own ext4 disk, on its own vmnet network (or, with [`network.transport: "brokered"`](/docs/configuration/security#network), with no network device), with no host mounts, socket relays, published ports, or host SSH-agent forwarding. The runtime's sandbox record has no field for any of those, and isolate verifies the running VM's effective configuration before every hand-out. [`design/apple-sandbox-runtime.md`](/docs/design/apple-sandbox-runtime) records why this replaced the earlier `container machine` fork.

### Prerequisites

- Apple Silicon, macOS 27 or later. The runtime’s underlying vmnet API has a
  macOS 26 floor, but this fork’s supported host minimum is macOS 27.
- `iso-sandbox`, built with `scripts/build-iso-sandbox.sh` (Xcode 27 and Swift 6.4 required).
- Stock Apple `container` 1.7.1 or later, with its service running (`container system start`). isolate uses it only to **build** images (`container build`) and to supply the guest kernel it installs; instances never run on it. isolate never starts, stops, or restarts that service.

Binaries come from `apple_container.binary` (iso-sandbox) and `apple_container.builder` (`container`), or else fixed install locations: `~/.local/opt/iso-sandbox/bin/iso-sandbox`, `/usr/local/bin/iso-sandbox`, `/opt/homebrew/bin/iso-sandbox`, and `/usr/local/bin/container`, `/opt/homebrew/bin/container`. `PATH` and project files are never consulted, and a binary that is group/world-writable or owned by neither you nor root is rejected, as is one under a directory that is owned by neither you nor root, world-writable without the sticky bit, or group-writable without the sticky bit unless its group is `wheel` or `admin` (Homebrew's prefix is `admin`-writable).

Host Docker is not needed. Docker runs *inside* the guest.

### Installing the runtime

```bash
scripts/build-iso-sandbox.sh            # installs ~/.local/opt/iso-sandbox/bin/iso-sandbox
```

It builds the Swift package in release mode, signs it ad hoc with the hardened runtime, the Enhanced Security entitlements and `com.apple.security.virtualization` (`iso-sandbox/iso-sandbox.entitlements`), and installs it without `sudo`. It refuses an existing `bin/` that is owned by neither you nor root, world-writable, or group-writable by a group other than `wheel` or `admin`. Pass a different prefix as the first argument and set `apple_container.binary` to match. Rebuild after pulling changes to `iso-sandbox`. `--experimental-coreai` instead installs the unreleased `iso-sandbox-coreai`, whose private entitlement needs a host with AMFI relaxed; see [`coreai.md`](/docs/coreai). isolate accepts protocol 5 with containerization 0.54.0 and refuses any other protocol or containerization version.

### Supported combinations

| iso-sandbox | containerization | macOS | Hardware | Evidence |
|---|---|---|---|---|
| 0.1.0 (protocol 5) | 0.54.0 | 27.0 | Apple Silicon | Requires the `network` mode and live `bootId`. Filtered egress also binds the live owner identity to its boot policy. Full filtered qualification remains open ([evidence](/docs/contributing/testing#local-filtered-vm-evidence-partial)). |

The runtime also pins its guest kernel by sha256 (`vmlinux-6.18.56-208-debug`, sha256 `98a1005f…f7511`, the Kata 4.3.1 kernel `container` 1.7.1 installs) and its init image (`vminit:0.54.0` by digest). `iso setup` fails with `APPLE_RUNTIME_UNAVAILABLE` on any other kernel.

Instances of [desktop images](/docs/images-and-profiles#linux-desktop-images) boot a second kernel with the virtio-gpu and USB input drivers, pinned separately (`KernelPin.desktopAllowed`). Releases install it beside `iso-sandbox` as `vmlinux-desktop`, with `iso-cu-mcp`; from source, build it with `scripts/build-desktop-kernel.sh OUT_DIR` and set `apple_container.desktop_kernel` to `OUT_DIR/vmlinux-desktop`. `scripts/build-iso-sandbox.sh` also builds `iso-cu-mcp` with the Swift Static Linux SDK; on a host that cannot (Xcode's own Swift rather than the swift.org toolchain, or no network to fetch the SDK) it warns and skips it, and only desktop images are unavailable. Every other instance keeps the kernel above; neither kernel is accepted in the other's place.

### Configuration

```jsonc
{
  "apple_container": {
    // "binary": "/absolute/path/to/iso-sandbox",
    // "builder": "/absolute/path/to/container",
    // "kernel": "/absolute/path/to/vmlinux",  // must be a kernel the runtime pins
    // "desktop_kernel": "/absolute/path/to/vmlinux-desktop",  // a pinned desktop kernel, for `desktop` images
    "probe_timeout_seconds": 10,       // version, inspect, list
    "operation_timeout_seconds": 60,   // resource changes, deletes, guest commands
    "create_timeout_seconds": 600,     // create (first unpack of an image), grow, commit, restore, init, maintenance install
    "boot_timeout_seconds": 120,       // boot to SSH-ready
    "stop_timeout_seconds": 90,        // clean systemd shutdown
    "build_timeout_seconds": 3600      // image build; `setup --builder-timeout` overrides
  }
}
```

Each timeout must be between 1 and 86400 seconds. Unknown keys are rejected, and there is no key to mount the home directory, forward the SSH agent, share a network, or skip qualification. The `vm` CPU/memory, image, guest-user, profile, and workspace settings apply; `vm.template_size_gib` is the default disk size.

Instance-image APT update/install commands show download output, retry transient
repository failures twice, and use 30-second HTTP/HTTPS connection and data
timeouts. These do not extend `build_timeout_seconds` or bound native agent
installers separately.

### State

Configuration defaults to `~/.iso/config.jsonc`, and `data_dir` defaults to
`~/.iso`. An explicit `--config` path must exist. The default data root must
be a real directory when present; symlink and regular-file roots are refused.
Custom configuration may select a separate `data_dir`.

The local secret store (`iso secrets`) lives in `<data_dir>/secrets/`.
Backend state remains under `<data_dir>/backends/apple-container-v1/`:

- `owner.json` (installation owner ID) and `vm_key`
- `images/<name>/`: `template-config.json`, `apple-image.json`, and `build.log`
- `instances/<name>/`: `apple-machine.json`, `known_hosts`, `operation.json` while a mutation is pending, `audit.jsonl` (boundary audit), `computer-use-audited.json` (the boots whose computer-use counts the audit holds), and the shared sidecars
- `audit/v1/`: the run history ([audit.md](/docs/audit)), kept outside instance directories so it outlives them
- `runtime/`, the iso-sandbox state root: kernel, init filesystem, private OCI store, cached base disks, committed disks, the maintenance boot disk (`maintenance/`), lock files (`locks/`), and one directory per sandbox (disk, record, console and owner logs, launchd plist, and `boot-counts.json` for a display sandbox); macOS templates and sandboxes under `macos/templates/` and `macos/sandboxes/`
- `images/<name>/macos-provision.sh` for a macOS image: the provisioning script its template was built with

Control files are `0600`, directories `0700`. `uninstall --purge` destroys
owned instances and removes only `backends/apple-container-v1/`; config files,
the secret store (`<data_dir>/secrets/`) and unrelated files remain. Workspace copies skip `.iso/`. The
`iso-<name>` SSH aliases use `# iso START` / `# iso END` markers. Explicit
user aliases with the same name are refused. Paths may contain spaces but not quote or control characters.

Host records require the current schema and backend identity. Machine sidecars
also require an explicit `lifecycle` (`reusable` or `disposable`); unknown or
missing values are refused. A macOS instance's sidecar adds
`guest_os: "macos"`; Linux sidecars omit it. A fresh installation does not adopt older state.

Fork macOS releases use this backend and include `iso-sandbox` beside `iso`.
The host prefers that adjacent runtime, then the manual install locations; an
explicit `apple_container.binary` still takes precedence. `iso update` targets
`chr33s/iso`.

### Setup process

`iso setup`:

1. Checks the platform, resolves and qualifies iso-sandbox (`iso-sandbox version`: protocol 5, containerization 0.54.0), and creates `owner.json` and the VM-access key pair.
2. Initializes the runtime root: copies the kernel after checking its pinned sha256, and pulls the pinned init image. Unless the runtime already has the current maintenance image, builds it (Ubuntu with e2fsprogs; log in `maintenance-build.log`), installs it with `iso-sandbox maintenance install`, and deletes the store copy.
3. Renders a minimal build context in a private temporary directory: a Dockerfile `FROM ubuntu:24.04` pinned by digest, the Apple provisioning script (packages, profiles, OCI features, guest user, Claude Code, Codex, Docker), and a machine-setup script. The context contains the isolate **public** key only. There are no build arguments and no secrets.
4. Checks that the builder's service is running, then runs `container build --platform linux/arm64 -t local/iso-<owner>:<hash>-<nonce>`, with output in `images/<name>/build.log`. Every build gets a fresh tag, so a rebuild never retags an image in use.
5. Saves the image as an OCI archive, imports it into the runtime's private store, and deletes the builder's copy.
6. Boots the image in a disposable sandbox with no credentials, passing the same isolation gate an instance does. It checks the required guest binaries and the guest user's uid (1000), and waits (up to `boot_timeout_seconds`) for `ssh` and `docker`. Then it stops and deletes the sandbox. The unpacked disk stays cached for the first `iso up`.
7. Records the image digest and input hash in `apple-image.json` and `template-config.json`. A failed build or verification deletes the new image and leaves the previous manifest and image in place. After a successful rebuild, the superseded image is deleted.

The image carries no SSH host keys and an empty `/etc/machine-id`. Each sandbox generates its own on first boot and keeps them across restarts. `sshd` refuses passwords and root logins and disables agent forwarding. Units that would fight the runtime's addressing (networkd, resolved, udevd, timesyncd) are masked.

Marketplaces and plugins are not baked into the image. The first boot installs the configured `claude` and `codex` ones through the shared bootstrap; a profile's `marketplaces` and `plugins` are not applied.

### How instances work

`iso up` creates one sandbox per instance, named `iso-<owner8>-<random16>`. The steps:

1. Write `operation.json`.
2. `iso-sandbox create` with explicit CPUs, memory (MiB), and disk (`--disk`, or the committed image's size, or `vm.template_size_gib`). The disk is an APFS clone of the image's cached base, so this takes milliseconds after an image's first use.
3. Check the runtime's record: owner tag, CPUs, and memory.
4. `iso-sandbox start` loads the sandbox's owner as a launchd job, explicitly requests startup with `kickstart` without `-k`, and returns once the owner answers. A loaded but deferred `RunAtLoad` job is not readiness. The owner process holds the VM and a dedicated `10.231.N.0/24` vmnet network.
5. The isolation gate reads the effective VM configuration from the owner and checks all of the following:
   - The sandbox runs `/sbin/init`, without nested virtualization.
   - It boots from its own disk under `runtime/sandboxes/<id>/`.
   - Its only mounts are the kernel pseudo-filesystems (`proc`, `sysfs`, `devtmpfs`, `mqueue`, `tmpfs` at `/dev/shm`, `cgroup2`, `devpts`) from their fixed sources.
   - It has no socket relays, published ports, or agent forwarding.
   - It has exactly one interface, on its own vmnet subnet, carrying the address the owner reports.
   - Its CPUs, memory, and image digest match the record.
6. Read `/etc/ssh/ssh_host_ed25519_key.pub` over the runtime's native control channel (vsock exec, an argv rather than a shell string), confirm the owner did not restart meanwhile, and pin the key in the instance's `known_hosts`.
7. Connect over SSH with `StrictHostKeyChecking=yes` against that pin, then hand off to the shared lifecycle: forwards, credentials, agent bootstrap, workspace copy, hooks.

Every later `ssh_target` (shell, exec, agent launch, push/pull, editor) re-inspects the sandbox and re-runs the gate before it returns a target. A sandbox keeps its address across restarts, unless its subnet had to be quarantined (see [Recovery](#stop-destroy-recovery)). Every start compares the host key with the pin. A changed or missing key fails with `APPLE_HOST_KEY_CHANGED`, and isolate never re-enrolls on its own. The one exception is `iso restore`: isolate replaced the disk itself (which removes the host keys), so the next start pins the key the guest generates.

Workspaces are always copied. `--mount` directories are synced once; use `iso push`/`iso pull`.

**Brokered instances** ([`network.transport: "brokered"`](/docs/configuration/security#network))
differ in steps 2, 4, 5 and 7:

- `iso-sandbox create --network brokered` records the mode and allocates no subnet.
- `iso-sandbox start --network-policy <digest>` records the boot's network-policy
  digest. The owner builds the VM with no interface, reads the live
  `VZVirtualMachine` after `create` and before the guest's init runs, and stops
  it unbooted unless it has no network device and exactly one socket device.
  It then serves a `0600` stream socket beside its control socket.
- The gate requires `transport: brokered`, `networkDevices: 0`,
  `socketDevices: 1`, no interface and no address, the runtime's channel
  policy equal to iso's own copy (and its digest equal to iso's recomputed
  digest), and the boot's network-policy digest equal to the one iso started
  it with. A vmnet sandbox reporting any of these fields is refused.
- SSH uses `ProxyCommand=<iso-sandbox> connect --root <root> <id> --boot <boot>
  --channel-policy <digest> --network-policy <digest>` and the pinned alias as
  its host name. The connector asks the owner for one `ssh` stream; the owner
  admits it only for the live boot and those digests, within its stream
  limits, and dials guest vsock port 2222 itself. The managed
  `~/.ssh/config` alias carries the same `ProxyCommand`, so an alias from an
  earlier boot is refused until `iso up`/`iso start` refreshes it.
- `iso-sandbox streams list --root <root> <id>` reports, and `streams close
  --root <root> <id> [--session S]` revokes, a running brokered sandbox's open
  streams.

The runtime advertises this as the `brokered-transport` feature on protocol 5;
vmnet output is unchanged.

Local model servers on host loopback reach the guest over a per-instance `ssh -R 127.0.0.1:<guest-port>:<host-addr>:<host-port>` tunnel. The forward goes to the exact loopback address the URL names. The guest port is the same as the host port, except that a privileged port (below 1024) moves to port + 40000, so `https://localhost` becomes `https://localhost:40443` in the guest. `localhost` and `127.0.0.1` URLs keep their host, so TLS names still verify. Other `127.x` addresses are rewritten to `127.0.0.1` for plain HTTP only. IPv6-loopback endpoints are rejected. Every boot first closes the tunnels recorded for the previous boot. Each bootstrap then reconciles the tunnels for both agents: live tunnels are kept, tunnels the config no longer needs are closed, and two endpoints that need the same guest port with different destinations are an error.

### Resize, commit, restore

All three need the instance stopped.

- **`iso resize --mem/--vcpus`** records the new values with `iso-sandbox set`, tagged with an operation id, and reads them back. They apply at the next start. The change is journaled; an interrupted one is reconciled on the next `iso start` from the runtime's record. With `--start`, if the boot fails and the sandbox is confirmed stopped again, the previous values are restored through the same journaled update, and only if the runtime's last committed operation is still the forward change; otherwise, or if the rollback cannot be confirmed, the result is `APPLE_OPERATION_UNCERTAIN`. The guest sees one more vCPU than configured: the runtime's own overhead.
- **`iso resize --disk`** (formerly `--size`) grows the disk offline. The runtime clones the disk, extends it, and runs `e2fsck`/`resize2fs` in a short maintenance VM, with the instance's disk attached as data. It then publishes the grown disk and its new size as one recoverable update (a crash between the two is finished by the runtime's next operation on the sandbox), so this takes about a second. Shrinking is refused.
- **Maintenance image.** Maintenance VMs boot their own small image (Ubuntu with e2fsprogs), which `iso setup` builds with the stock builder and installs into the runtime outside its image store, then removes from the store. It does not depend on any instance's image, so deleting or replacing images never affects growth or commits. `iso setup` reinstalls it when its recipe version changes.
- **`iso commit --image <name>`** saves an APFS clone of the disk with its SSH host keys and machine-id removed. `iso up --image <name>` and `iso restore` then clone it, and every instance created from it generates its own identity.
- **`iso restore`** swaps in a clone of a committed disk, or a fresh copy of a base image with `--reprovision`. It then grows the new disk back to the instance's size if that is larger. The operation is journaled: a restore interrupted by a crash is reconciled on the next `iso start` from the runtime's record, and it re-pins the host key only if the runtime's last committed operation is that restore (a higher disk generation alone is not enough).

### Stop, destroy, recovery

- **Stop.** `stop` asks systemd to halt (the runtime forces the VM down after 60 s) and confirms the sandbox reached `stopped`. An unconfirmed stop is `APPLE_OPERATION_UNCERTAIN`, and nothing is deleted. When the normal liveness check fails (an unqualified runtime, a sandbox that fails the gate, or an unfinished journal), `iso stop` stops the owned sandbox through the runtime alone, with no SSH and no qualification, and keeps its disk. `iso status` lists such an instance as `unknown`. A boot that fails or times out during `iso start` stops the sandbox again.
- **Interrupts.** Ctrl-C interrupts only image builds, creates, and boots. Stop, delete, and cleanup commands always run to completion.
- **Destroy.** `destroy` acts only on sandboxes whose names and local records match this installation's owner ID; the runtime also refuses to delete a sandbox whose recorded owner differs. It stops and deletes the sandbox, confirms it is gone, then removes local state. If an operation was interrupted (`operation.json` exists), `destroy` checks what the runtime actually has and removes only what the journal says isolate created.
- **Crashed owners.** The VM lives inside its owner process. If that process dies, the VM powers off (no VM is ever orphaned). The background user-domain launchd job relaunches after abnormal exits, booting the same disk even while the GUI session is locked, and leaves clean exits stopped ([recovery checks](/docs/contributing/testing#native-owner-startup-and-launchd-scheduling)). Journaled ext4 recovers on restart, but unsynced guest writes can be lost.
- **Subnet leaks.** After an unclean exit, vmnet keeps the sandbox's subnet reserved for hours. The runtime then quarantines it and moves the sandbox to a free subnet, so its address changes while its identity does not.
- **Image deletion.** Only this installation's images and committed disks are deleted. Instances never depend on them after creation.

### Diagnostics

| Identifier | Meaning |
|---|---|
| `APPLE_RUNTIME_UNAVAILABLE` | No usable iso-sandbox or builder, builder service not running, kernel not accepted, or unsupported platform. |
| `APPLE_RUNTIME_UNQUALIFIED` | Unknown runtime, protocol, `containerization` version, or output schema (including an unknown field in the effective configuration). |
| `APPLE_NETWORK_ISOLATION` | Missing, extra, or foreign network interface, or an address that does not match; for a brokered sandbox, any network device, interface or address, or a boot started with another network policy. |
| `APPLE_HOST_EXPOSURE` | A host mount, socket relay, published port, agent forwarding, foreign root disk, or non-systemd init; for a brokered sandbox, a channel policy other than iso's. |
| `APPLE_IDENTITY_CONFLICT` | Ownership, name, image, resource, or boot identity mismatch. |
| `APPLE_HOST_KEY_CHANGED` | Missing or changed pinned host key. |
| `APPLE_SESSION_EXPIRED` | The instance's `limits.session_ttl` has passed. The owner halts the VM at the deadline; the host also refuses to hand out a sandbox whose deadline has passed. `iso stop` then `iso start` begins a new session. |
| `APPLE_BOOT_TIMEOUT` | Boot or readiness failed or exceeded its deadline, or no valid host key appeared in time; the error includes the last lines of the console log. Disk and journal are kept. |
| `APPLE_OPERATION_UNCERTAIN` | Timed-out or cancelled runtime call, unconfirmed stop, a booting or crashed sandbox, or an unfinished journal; reconciled on retry. `iso list` shows a crashed sandbox as stopped, since `iso start` accepts it. |

`iso logs` (snapshot and `--follow`) replaces control characters in the guest's console output before printing it.

Runtime and builder commands run with a cleared environment: only `HOME`, `USER`, `LOGNAME`, `TMPDIR`, locale, and a fixed `PATH` pass through. `SSH_AUTH_SOCK`, API and GitHub tokens, `DYLD_*`, and `CONTAINER_*` overrides are dropped. The launchd job that runs each owner gets a fixed environment of its own. Guest-bound `ssh`, `scp` and `rsync` likewise inherit only a minimal host environment plus the values isolate forwards, so a user's `SendEnv` patterns cannot leak an unrelated host variable.

### Validation status

Validated on macOS 27.0 (Apple M5 Max) with iso-sandbox 0.1.0 and containerization 0.45.0, and on 2026-11-10 with containerization 0.54.0 (full integration suite: 298 passed, 2 opt-in skips); see the table above.

- **Runtime ([`tests/integration-apple-sandbox.sh`](https://github.com/chr33s/iso/blob/main/tests/integration-apple-sandbox.sh); the selection experiment is in [`design/apple-sandbox-runtime.md`](/docs/design/apple-sandbox-runtime)):**
  - Peer isolation: a root guest cannot reach another sandbox by TCP, UDP, or ICMP over IPv4 or IPv6. That holds with forged on-link routes, static neighbour entries, spoofed source addresses, and broadcast/multicast, and after restarts; the host reaches each listener as the positive control.
  - Host exposure: no mounts, agent sockets, host canary file, or host vsock listeners reach the guest, and a canary secret never reaches the runtime, its logs, the image, or the guest.
  - Identity and lifecycle: pinned SSH over the native channel; 20 stop/start cycles with no loss of data or identity; CPU/memory changes, disk growth, and commit/restore.
  - Recovery and scale: every crash-injection scenario ends in a known state, and 1/4/8 concurrent sandboxes each get their own address and subnet.
- **isolate end to end:** the suite's `iso` phase covers `setup` (build, import, verification), `up`, `exec`, `status`, `stop`/`start`, `resize --size/--mem/--vcpus` (the older spelling of `--disk`), rollback of a failed `resize --start`, `commit`, `restore` with host-key re-pinning, `destroy`, and image deletion. Run by hand on 0.1.0 only: `up` with an explicit disk, `logs`, `up --image` from a committed image with a fresh identity, and rejection of a guest-changed host key.

Not covered: other macOS releases or kernels, and live-provider API calls.
