Isolating Claude Code on a Mac with Apple container
The article, written by an engineer at Japanese company Gixo, explains how to set up an isolated work environment for Claude Code on a Mac using Apple container[1], a tool Apple publishes that runs each container in a lightweight VM. The author tested it in November 2026 with Apple container 1.7.1, Claude Code 2.1.325 and macOS 26 on Apple silicon.
Only two things are mounted into the container: the repository, and a folder outside it that stores Claude Code and gh login data. Outbound traffic is limited by an iptables allowlist of domains, and the firewall is fail-closed[2], so the container does not start if the firewall cannot be set up. The author notes that the allowlist works on IP addresses, so sites sharing a CDN address may be reachable, and DNS queries are allowed, so the block is not complete.
The startup script sets up the firewall as root, then starts Claude Code as an ordinary user with all privileges removed using setpriv[3]. Tool versions are pinned in a config file and auto-update is disabled. A verify script runs checks from inside the container, and the sample output shows 27 PASS and 0 FAIL.
Sources
-
JPZenn JA
Apple container で Claude Code の隔離した作業環境を作る


