Local WordPress development on macOS, built on Apple's native
container runtime.
A SwiftUI app, CLI, and MCP server for running sites and isolated git branch environments,
with the whole WordPress install in a plain folder you own.
WP Container creates and manages local WordPress sites, each running in lightweight
Apple container VMs (WordPress + MariaDB per site). Every site's full WordPress
installation lives in a normal folder on your Mac — drop your git-managed
wp-content plugin or theme repos straight in and they're live immediately.
~/WP Container Sites/my-blog/
├── wordpress/ ← the entire WP install, host-visible (mounted to /var/www/html)
│ └── wp-content/ ← your git repos go here
├── database/ ← MariaDB data, survives restarts (also serves the
│ branch environments' schemas)
└── wp ← per-site wp-cli shim
Sites are provisioned automatically (no install wizard) and log in with
admin / password.
-
One-click sites — create, start, stop, delete from a Studio-style UI; sidebar with live status, per-site overview, streaming container logs.
-
Branch environments (git worktrees) — spin up an isolated, fully-running clone of a site for any branch of a repo inside
wp-content, in ~5 seconds (APFS copy-on-write + a bind mount that shadows the repo path with the worktree checkout). The parent site keeps running untouched. An env's database is its own schema on the parent site's existing MariaDB container, so it runs one container instead of two — see Shared databases. Built for AI agents:wp-container worktree create --site my-blog \ --repo wp-content/plugins/my-plugin --branch feature-x --json # → {"url": "http://my-blog-wt-feature-x.localhost", # "localUrl": "http://127.0.0.1:8882", "path": …, "worktreePath": …}
Envs unused for 7+ days are flagged for settling: a settled env stops, leaves the sidebar and gives its ports back, but keeps its checkout, files and database (
wp-container worktree settle|restore <env>, or the Settle buttons in the app). Settled envs are deleted after 30 days unless that's turned off in Settings → Sites; a checkout with uncommitted changes is left on disk. Tools that make their own worktrees can hand them over withworktree adoptinstead — see Using worktrees from other tools. -
wp-containerCLI — everything the app does, scriptable, with--jsoneverywhere:list,create(--wp/--php/--web-server/--multisite/--domain/--group),start,stop,delete,worktree …,wp …(wp-cli proxy),web-server,xdebug,elasticsearch,domain,https,resolve-site,setup wp. Install withmake install-cli(adds awpcshortcut + the globalwprouter binary). -
Ephemeral containers, durable sites — containers are disposable (
--rm); all state lives in the site folder. Sites survive app restarts and reconcile against real container state via labels. -
Native macOS window — a library sidebar, your sites as a gallery of homepage snapshots or a sortable, configurable list, and an inspector (⌥⌘I) with every setting for the selection. Each site gets a screen with its branch environments, live CPU / memory / network, the add-on stack and logs, plus a Branches table with filters and bulk actions for sites with dozens of environments. Site groups with drag & drop, archived sites, each site's WordPress Site Icon as its avatar, and a menu bar extra for one-glance status and start/stop of every site.
-
Menu-bar-first option — app settings (⌘,) cover hiding the Dock icon, launch at login, default sites folder and WP×PHP versions, HTTPS-proxy autostart, and notifications. Native macOS notifications fire for background start/stops, site creation, branch environments coming up (click to open), core updates, and proxy failures.
-
Xdebug & Elasticsearch — per-site one-click toggles in the inspector's Development card. Xdebug builds a derived image once per base tag and points
client_hostat the host gateway (port 9003); Elasticsearch runs a single-node sidecar wired into WordPress (ElasticPress-ready). Recipes validated inscripts/validate-addons.sh. -
Custom domains — give a site
mysite.local; a managed/etc/hostsblock plus the host proxy route it (HTTP and HTTPS), the local cert re-issues to cover it, and WordPress URLs update automatically. A domain missing from that block (the admin prompt was skipped, or another tool removed its entry) is flagged on the site's Overview tab and inwp-container start; Sync orwp-container domain syncadds it back. -
Multisite — create subdirectory or subdomain networks from the setup guide (
wp core multisite-install+ MULTISITE constants + network.htaccess); the Overview tab lists network subsites. Subsite hostnames (subdomains of a custom domain, or a subsite's own mapped domain) are read from WordPress on every start and get proxy routes, certificate coverage and loopback entries, and are flagged and synced the same way. -
WP × PHP versions — the new-site flow is a 3-step guide (name → WordPress × PHP version with a live image-tag preview → options); change PHP later (image swap + restart) or update core from the inspector's Software card.
-
Apache or nginx — pick the web server when creating a site, or switch it later from the inspector's Software card (
wp-container web-server nginx <site>). nginx sites run nginx + PHP-FPM in one container, built once per version from the officialwordpress:<version>-fpmimage; files and database are untouched by a switch. Extra nginx rules go in the site'snginx/folder (next towordpress/): each*.conffile is included in the server block on the next start, and a config that failsnginx -tis skipped with the error in the container log. -
MCP agent tools —
wp-container agent-tools enable <site> [--root …]writes.mcp.json(+ Cursor/VS Code configs) and a markedAGENTS.mdblock into a chosen root (site folder, or yourwp-contentrepo root for IDE discovery); the bundled MCP stdio server (wp-container mcp --site <slug>) exposes 27 tools in the spirit of 10up/localwp-agent-tools:wp_cli,run_command,run_tests, log readers,wp-configediting, site info/health, start/stop/status,list_sites,worktree_*,xdebug_toggle/web_server_set/elasticsearch_toggle, pluslogin_link/create_user. -
Agent-friendly login —
wp-container login <site>prints a one-time magic login link (single-use, 15-minute expiry) that opens straight into a logged-in wp-admin — nowp-login.phpform for agents to fumble.--openopens it, and thelogin_link/create_userMCP tools expose the same for agents. -
Zero project-tree footprint — all runtime PHP WP Container manages (magic login, Mailpit mail routing, remote-media rewriting) loads via a single
auto_prepend_filein each site's privatephp/folder, never as a mu-plugin underwp-content/, so nothing can be committed to your repo by accident. -
Trusted HTTPS — mkcert-style local CA trusted per-user in the login keychain (no admin password — Touch ID supported);
https://<site>.localhost(or your custom domain) served by a host-side TLS reverse proxy (443, Host-header routing). -
wp-cli everywhere —
wp-container wp <site> -- …; a./wpshim in every site that maps your current subdirectory into the container; an optional globalwprouter (wp-container setup wp) so plainwpinside a site runs containerized wp-cli and defers to Homebrew'swpelsewhere; an interactive WP-CLI Terminal button; and the MCPwp_clitool. -
Run any command in a site —
wp-container run <site|env> -- <command>runs in the live WordPress container with its database, Mailpit, Elasticsearch, and PHP environment (php,wp);--image composer:2or--image node:20runs a one-shot container with the same mounts for tools the WordPress image lacks. The working directory follows your current folder, and the MCPrun_commandtool exposes the same to agents. -
PHPUnit integration tests, wp-env style —
wp-container test <site|env> -- <phpunit args>runs a plugin or theme'svendor/bin/phpunitagainst a dedicated test schema (the site's data is never touched), with the WordPress test library for the site's version downloaded once and exposed asWP_TESTS_DIR. Run it from the project folder or pass--path; the MCPrun_teststool returns pass/fail counts to agents. -
Sites from
.wp-env.json—wp-container create <name> --wp-env <project>builds a site from a project's.wp-env.json(with.wp-env.override.jsonandenv.development): WordPress and PHP version, multisite, andconfigconstants. Local plugins, themes, and mappings are mounted live, remote ones (GitHubowner/repo#ref, zip URLs) installed, and plugins activated. -
Mounted folders —
wp-container mount add <slug> <folder> <path>bind-mounts a host folder into a site's WordPress folder, such as a plugin repo atwp-content/plugins/<name>, so edits reach the site live.mount listandmount removemanage them, andcreate --mount <folder>:<path>mounts folders when the site is created. -
Dev-ready by default — every site gets
WP_DEVELOPMENT_MODE=all/WP_ENVIRONMENT_TYPE=local, with liveWP_DEBUG-family switches in the inspector's Development card. -
Mailpit email catching — per-site toggle; all outgoing mail lands in a local mailbox (
https://<site>-mail.localhost, plus a REST API agents can read). Persistent across restarts. -
Redis object cache — per-site toggle (
wp-container redis on <site>); runs a Redis container and definesWP_REDIS_HOST/WP_REDIS_PORTfor an object-cache drop-in such as the Redis Object Cache plugin, which you install in the site. -
Per-site resource limits — cap CPU/memory per site in the inspector's Resources card or
wp-container limits <slug> --cpus 2 --memory 512(see docs/RESOURCES.md). -
Auto-stop idle, wake on request — a branch environment nobody has used for 3 hours is stopped and its ~500 MB returned to macOS; the next request to its URL starts it again behind a "waking up" page that refreshes into the live site. A freshly created environment still on that default gets a further 6-hour grace period during which it is never auto-stopped regardless of use — an explicit timeout (
wp-container idle <env> --minutes N) always wins over the grace period, exactly like it wins over the default itself. On by default for environments, opt-in for sites.wp-container idle <slug>, the Idle stop card, or theset_idle_stopMCP tool — see docs/RESOURCES.md. -
Export and import sites — pack a site (files, database dump and settings) into one
.zipand import it on another Mac as a new site with its own name and domain; URLs, including multisite networks, are migrated to the new address.wpc export/wpc import, thesite_export/site_importMCP tools, or in the app: Export Site… from a site's right-click menu, and File ▸ Import Site… (⇧⌘I) or a.zipdropped on the window. -
Touch ID for privileged actions — the optional signed hosts-helper makes custom-domain changes a Touch ID dialog instead of a password prompt (one-time enable in Settings → General).
- macOS 26 (Apple Silicon)
- Apple
container≥ 1.1.0 (brew install containeror the release installer); the app offers to start its system service - Xcode 26+ and XcodeGen to build from source
git clone https://github.com/fabiankaegy/wp-container.git
cd wp-container
make build # xcodegen + xcodebuild (app + CLI)
make test # unit tests (kit + hosts helper)
open build/Build/Products/Debug/WPContainer.app
make install-cli # optional: /usr/local/bin/wp-container + wpcEach pull request's Build run attaches a Debug build of the app,
WPContainer-pr<number>-<commit>.zip, under Artifacts on the run's summary page.
It is built from the pull request merged into main and kept for 14 days.
ditto -x -k ~/Downloads/WPContainer-pr<number>-<commit>.zip ~/Downloads
xattr -dr com.apple.quarantine ~/Downloads/WPContainer.app # the build is signed ad-hoc
open ~/Downloads/WPContainer.appThe build runs the pull request's code with your user's access, so only run builds
of pull requests you have read. It uses the same site list and sites folder as an
installed WP Container,
so quit the installed app first and test on throwaway sites. Its CLI is at
WPContainer.app/Contents/MacOS/wp-container; an installed wpc still runs the
installed app's CLI.
Each site runs two containers (wpc-<slug>-wp, wpc-<slug>-db) labeled
dev.wpcontainer.site=<slug>, with the site folder bind-mounted in. The app and
CLI share one store (~/Library/Application Support/WPContainer/sites.json) with
file locking, and treat container labels as ground truth. Notable Apple-container
specifics we handle for you (all empirically verified — see
scripts/validate-container-workflow.sh): WordPress core is pre-seeded because
virtiofs mounts reject chown, MariaDB runs as its own uid, and the DB's IP is
re-discovered on every start.
Each container runs in its own lightweight VM — memory/CPU defaults, real measured usage, and the limitations to be aware of are documented in docs/RESOURCES.md. Short version: caps aren't reservations, stopped sites cost zero, and stopping unused sites is the lever that matters — which is why the proxy now does it for you (below).
Apple container never returns guest memory to macOS, so a running VM's host
footprint is its high-water mark and only stopping it reclaims anything. VM boot
is ~1s, which makes that trade cheap: the reverse proxy tracks when each site and
environment was last used, stops the ones past their timeout, and starts them
again on the next request while serving a page that auto-refreshes into the live
site.
- Environments: on by default (3 hours), with a 6-hour grace period after
creation. Sites: off by default. The difference between envs and sites is
observability, not importance. An environment's container
publishes no host port — the proxy serves its
<env>.localhostdomain (the URL every surface advertises, and that WordPress has ashome/siteurl) and binds127.0.0.1:<env port>itself, relaying both to the container — so every way into an environment runs through the proxy. Every request to an environment therefore counts as use, and reopening a parked one wakes it at that same URL. A site still publishes its own port, and a request straight tohttp://127.0.0.1:<port>bypasses the proxy — that's the one remaining blind spot, and why sites stay opt-in. - What else counts as use: wp-cli, MCP tool calls, magic-login links and explicit starts, recorded as a persisted stamp so they work across processes. Full table in docs/RESOURCES.md.
- A site is never auto-stopped while any of its environments are running, and stopping an environment also retires the parent's shared MariaDB container once nothing else needs it — that's the other ~470 MB.
- Configure per instance: the Idle stop card in the inspector for a site or an
environment,
wp-container idle <slug> [--minutes N | --off | --default], or theset_idle_stopMCP tool so an agent can opt its own environment out while it's mid-task and back in when it's done. - Enforcement — and, for environments, reachability — lives in whichever process
owns the proxy: the app, or
wp-container proxy serve. The app starts it automatically when an environment starts; the CLI and MCP warn when nothing is listening (the environment still starts; wp-cli and MCP need no HTTP).
A branch environment does not run a MariaDB container of its own. It gets its
own schema (wpc_<env-slug>) on the parent site's existing server, cloned from
the parent's data at creation time. That halves the container count per env —
2 VMs → 1 — and since a MariaDB VM costs ~470 MB of real memory regardless of how
much data it holds, the marginal cost of env #5 or #10 is close to zero.
Practical consequences:
- An env's database is only available while the parent's
wpc-<site>-dbcontainer is running. Starting an env starts that container if it isn't up; stopping the last running env of a stopped site shuts it down again. Stopping or deleting an env never touches the parent's database container itself. - Deleting an env drops exactly its own
wpc_*schema. If the server happens to be down at that moment, the name is recorded on the parent site and dropped the next time an env is created for it. Only names recorded that way are ever dropped — never "everywpc_*schema the store doesn't recognise", which would race an environment being created alongside it and destroy a live database. - The env's WordPress finds its schema through
WORDPRESS_DB_NAME, so nothing on disk is edited. If a project ships its ownwp-config.phpwith a hardcodeddefine('DB_NAME', …)the env would silently write into the parent's database — so creation detects that and falls back to a dedicated container, with a warning saying so.
Pass --isolated-db (CLI), isolated_db: true (MCP), or switch on Isolated
database in the New Branch Environment sheet to opt out and get a dedicated
container. It's worth it for a genuinely large database: an isolated env off a
stopped parent copy-on-write-clones the database/ folder, which is instant at
any size, whereas the shared path is always a logical dump and restore.
Agent tools like T3 Code and herdr
create their own git worktree for each thread or workspace. worktree adopt
turns such a checkout into a branch environment without moving it:
wp-container worktree adopt --path ~/.t3/worktrees/wp-content/t3code-1a2b3c4d
# → Adopted … as env my-blog-wt-t3code-1a2b3c4d at http://my-blog-wt-t3code-1a2b3c4d.localhostThe site and repo path are found from the checkout's main repo (it must live in
a site's wordpress/ folder), and the branch from the checkout. The rest is the
same as worktree create. The other tool keeps ownership of the checkout:
deleting the env, rolling back a failed adopt, and the settled-env purge all
leave it on disk. Running adopt again on an adopted checkout starts its env,
restoring it first if it was settled.
Because the env records where the checkout lives, wp, wp-container run and
the MCP tools resolve to the env from anywhere inside it, so an agent working in
the other tool's worktree reaches its own site and database without any setup.
Any tool that can run a command on its worktree events can drive this:
| Tool event | Command |
|---|---|
| Worktree created, or opened again | wp-container worktree adopt --path <checkout> --skip-unmatched |
| Worktree archived or removed | wp-container worktree settle --path <checkout> --skip-unmatched |
--skip-unmatched makes both commands do nothing for repos that aren't in a WP
Container site, so one global hook covers every project. settle --path finds
the env by the checkout path it recorded, so it also works after the tool has
deleted the checkout. A settled env keeps its files and database: when a
checkout comes back at the same path, adopt restores the env.
Add two scripts. Set them as the default project scripts to cover every project at once.
| Script | Command | Options |
|---|---|---|
| WP env | wp-container worktree adopt --path "$T3CODE_WORKTREE_PATH" --skip-unmatched |
Run on worktree creation, not async (the agent waits until the env is up) |
| Settle WP env | wp-container worktree settle --path "$T3CODE_WORKTREE_PATH" --skip-unmatched |
Run on settle |
Unsettling a T3 thread has no hook. The env comes back on the next wp, run
or login against it, or by running the WP env script again.
Install the herdr-wp-container
plugin (herdr plugin install s3rgiosan/herdr-wp-container), or write your own
with event hooks. Each hook reads the checkout path from .data.worktree.path
in HERDR_PLUGIN_EVENT_JSON.
| herdr event | Command |
|---|---|
worktree.created, worktree.opened |
wp-container worktree adopt --path <path> --skip-unmatched |
worktree.removed |
wp-container worktree settle --path <path> --skip-unmatched |
herdr runs event hooks in the background, so a new workspace can open before
its env is up. herdr removes the checkout before worktree.removed fires; the
env is settled, and comes back if the branch is checked out again at the same
path.
PLAN.md— full architecture and product spec.scripts/validate-container-workflow.sh— end-to-end proof of the container recipe (site lifecycle, persistence, worktree cloning).scripts/validate-addons.sh— Xdebug image build + Elasticsearch validation.- Targets:
WPContainerKit(models + services),WPContainer(SwiftUI app),wp-container(CLI). Swift 6 strict concurrency throughout.
WP Container is released under the MIT License. The open-source packages it links are listed, with their licenses, in THIRD_PARTY_NOTICES.txt.
WordPress is a trademark of the WordPress Foundation. WP Container is not affiliated with or endorsed by the WordPress Foundation or Automattic.


