CLI reference
Reference for every anvil CLI command, covering sites, worktrees, PHP versions and extensions, language runtimes, services, databases and local HTTPS.

Every command and subcommand takes --help; anvil --version prints the version.
Sites answer at <name>.test (<name>.localhost on Linux), named after their folder or link name. With the CLI alone, restart
anvil start after changing sites or versions. The desktop app applies changes right away.
Output is colored on a terminal and plain when piped; NO_COLOR and CLICOLOR_FORCE override.
Settings commands (anvil app, anvil service, anvil use, anvil php ini) print what they set,
e.g. blog: port 3901. An unknown name fails with No app named … or No service named … and points
to anvil apps or anvil service list.
Sites
| Command | Description |
|---|---|
anvil park [path] | Serve every sub-folder of a directory (default: current) |
anvil forget [path] | Stop serving a parked directory, also one that was deleted. Fails for a folder that isn't parked |
anvil link [name] | Serve the current directory as <name>.<tld> |
anvil unlink <name> | Remove a linked site. Fails for a name that isn't linked |
anvil apps | List applications with address, type and web root (anvil sites works too) |
anvil new <kind> <name> [--in <dir>] [options] | Create an application from a template: laravel, statamic, symfony, wordpress, php, static, next, nuxt, vite, node, rust, go, dotnet, django, fastapi, flask. Makes a Git repository with a first commit unless --no-git. Default location: the first parked folder. Options, as in the New application sheet: --starter, --db (Laravel: sqlite or a MySQL/PostgreSQL service; WordPress: a MySQL service), --framework, --pm, --php, --node, --ts/--no-ts, --tailwind/--no-tailwind, --https/--no-https. anvil new --help shows which template takes which; other flags are refused |
Worktrees
See Worktrees for databases and hooks.
| Command | Description |
|---|---|
anvil worktree list [app] | List Git worktrees of one application, or all |
anvil worktree add <branch> [--app <app>] [--new] [--copy-db[=false]] | Add a worktree of the current application (or --app) next to it, served as its own site. A branch that doesn't exist yet (or any, with --new) is created from the application's current one. --copy-db copies the database, --copy-db=false starts empty; unset follows the worktree hooks |
anvil worktree hooks [app] | Print an application's worktree hooks and where each field comes from |
anvil worktree use-db <name|branch> [--yes] | Use an existing, non-Anvil database with the worktree's name; --yes skips the prompt |
anvil worktree remove <name|branch> [--drop-db] [--force] [--yes] | Remove a worktree's folder (stop it in Anvil first). --drop-db also drops its recorded databases, Anvil-made and Use existing ones; SQLite files go with the folder. --force removes it despite uncommitted changes or unpushed commits. Untracked data (SQLite files, an edited .env) is listed and needs confirmation; without a terminal it's refused unless --yes |
PHP
| Command | Description |
|---|---|
anvil php install <version> | Install the latest patch of a PHP minor version, e.g. 8.4 |
anvil php update [version] | Install the newest patch of an installed version; omit for all. php.ini is kept, extensions are built again |
anvil php list | List installed PHP versions, whether each has OPcache, previews, and newer patches |
anvil php opcache <version> | Build OPcache for a PHP 8.1–8.4 an earlier Anvil installed without it, on macOS; needs the Xcode command line tools. PHP Anvil installs now has it built in |
anvil php mysqli <version> | Build mysqli for a PHP an earlier Anvil installed without it, on macOS; WordPress needs it. PHP Anvil installs now has it built in |
anvil php ext add|remove <ext> [--php <version>] | Turn an extension (xdebug, pcov, apcu, igbinary, msgpack, mongodb, redis, memcached, imagick, sqlsrv, pdo_sqlsrv) on or off for every app on a PHP version (default: the default PHP). Builds it first if needed; off keeps the build. Restarts PHP-FPM in the running app. Not on Linux yet; memcached and imagick not on Windows yet |
anvil php ext list [--php <version>] | What PHP has built in (the Built in: line), the extensions Anvil can add, whether each is on or built, and applications' own |
anvil php ext build <folder> [--php <version>] [-- <configure args>] | Build your own extension from its source folder (with config.m4) into the version's own folder; turn it on with extension=<name> in php.ini. macOS only |
anvil php uninstall <version> | Remove a PHP version; refused for the default and while applications are pinned to it |
anvil php ini <key> [value] | Set a php.ini value for every site (web, its processes and the terminal php); omit the value to clear it |
anvil use <version> | Set the default PHP version |
anvil app php <site> [version] | Pin one site's PHP version; omit for the default |
anvil app ini <site> <key> [value] | Set a php.ini value for one site; omit the value to clear it |
anvil app ext <site> add|remove <ext> | Turn an extension on or off for one app, which then gets its own PHP-FPM |
anvil app root <site> [dir | --reset] | Web root relative to the project, e.g. web, dist, .. No dir shows the current one; --reset goes back to detection. PHP and static sites only |
Languages and applications with their own server
| Command | Description |
|---|---|
anvil runtime list | Installed and available Node.js, Go, Rust, .NET and Python versions |
anvil runtime install <id> <version> | e.g. node 22, go 1.27.2, rust stable, dotnet 10.0 |
anvil runtime uninstall <id> <version> | Remove a version, e.g. node 22; refused while applications are pinned to it |
anvil app command <site> [command] | Set the start command; omit for the default |
anvil app runtime <site> [version] | Pin the language version (e.g. 24 for Node.js); omit for automatic. Refused for .NET, where dotnet picks the SDK from global.json |
anvil app autostart <site> <true|false> | Start the application whenever Anvil starts |
anvil app type <site> [kind] | Set the application type (e.g. vite); omit for the detected one |
anvil app port <site> [port] | Pin the private port; omit for automatic |
anvil app start <site> [process] | Start the application and its Dev start processes, or one process, in the running desktop app |
anvil app stop <site> [process] | Stop the application and all its processes, or one process, in the running desktop app |
anvil app restart <site> [process] | Restart the application and its Dev start processes, or one process, in the running desktop app |
anvil app requests <site> [--status 4xx] [--method POST] [-n 50] [--assets] [-f] | The latest requests the application served, oldest first. --assets includes static assets; -f follows new ones. Fails while Settings › Features › Request log is off |
anvil app browser <site> [-n 20] [-f] [--on|--off] | The application's browser errors, grouped; -f follows new ones; --on/--off turns them on or off (not static sites) |
anvil app pnpm <site> | Move an npm or yarn application to pnpm, importing its lock file; everything is put back if it fails |
anvil app share <site> | Share the application at a temporary public address (a Cloudflare quick tunnel; see Tunnel) until Ctrl-C |
anvil app mail <site> [--open <id>] [-n 20] | With the Mail catcher on: the application's latest mail; --open prints one with headers, attachments, links and text. Otherwise: the inbox address of the Anvil Mailpit its .env sends to |
Services
See Services.
| Command | Description |
|---|---|
anvil service list | List services and their state |
anvil service add <kind> [name] [--port <port>] [--version <version>] [--accept-license] | Add mysql, postgres, redis, mailpit, versitygw or silo (S3). The version is downloaded on first use (Redis is built from source; on Windows it is Garnet). Asks once to accept the license, or pass --accept-license. Refused before downloading on a macOS too old for it |
anvil service add --docker <image> [name] --port <port>:<container port> [--env KEY=value…] | Add a Docker image Anvil runs |
anvil service add --container <container> [name] | Add a Docker container that is there already; Anvil never deletes it |
anvil service add --external <host>:<port> --kind mysql|postgres|redis|other [name] [--user <user>] [--password <password>] [--database <db>] | Add an external server Anvil doesn't run |
anvil service versions | Versions each service offers, and which are installed |
anvil service databases <name> | Contents of a running service: databases and sizes, Redis keys, Mailpit messages, S3 buckets |
anvil service create-db <name> <db> | Create a database in a running MySQL or PostgreSQL service |
anvil service drop-db <name> <db> | Drop a database from a running MySQL or PostgreSQL service |
anvil db open <service|app> [database] | The address that opens a MySQL or PostgreSQL service (at one of its databases), or an application's database, logged in to the Database viewer |
anvil service remove <name> [--delete-data] | Remove a service; data is kept unless --delete-data |
anvil service tag <name> [tags…] | Set tags, e.g. queue; none clears them |
anvil service link <name> [apps…] | Set the applications using the service; none clears them |
anvil service uninstall <kind> <version> | Remove a program version no service uses, e.g. redis 7.2.16 |
anvil service enable <name> | Start the service with Anvil |
anvil service disable <name> | Don't start the service with Anvil |
anvil service start <name> | Start in the running desktop app, and enable |
anvil service stop <name> | Stop in the running desktop app, and disable |
anvil service port <name> [port] [--web [port]] | Set the port; omit for the default. --web sets the web port of Mailpit's inbox (default 8025) or the S3 console (default 7071 for Versity S3 Gateway, 9001 for SILO); no value resets it |
Inspecting applications
| Command | Description |
|---|---|
anvil git [site] | Branch, changes, last commit and remote (default: current folder) |
anvil logs <site> [--source <file>] [-n <count>] [--level <level>] | Recent log entries, oldest first. --source: a file name like laravel.log, app or php-fpm (default: newest); -n defaults to 20; --level: error, warning, info or debug |
anvil packages [site] [--updates] [--audit] | Dependencies and locked versions of an application or folder (default: current). --updates checks registries for newer ones; --audit also runs composer audit / npm/pnpm/yarn/bun audit |
anvil usage [site] | Disk usage of an application, what is safe to delete, and its services. Without a site: Anvil's own footprint and every application's size |
anvil clean [site] [paths…] [--safe] | Delete items anvil usage lists, or every safe-to-delete item with --safe. anvil clean --safe covers every application. Rebuildable items are deleted only while the application is stopped |
Running Anvil
| Command | Description |
|---|---|
anvil setup | Download the web server, put the commands on PATH and print one sudo command for the missing system steps: local domains, standard ports, HTTPS certificate. On Windows it asks for administrator permission itself; on Linux it only sets up the commands |
anvil project [site] [--apply] [--accept-license] | What an application's .anvil.toml asks for (PHP, Node.js, PHP extensions, services) and what is missing (default: current folder). --apply installs and adds it; --accept-license accepts service licenses without asking |
anvil which <tool> | What php, composer, laravel, forge, node, npm, npx or pnpm resolves to in the current folder |
anvil start | Run DNS, PHP-FPM, the web server, enabled services and autostart applications in the foreground. Refused while the desktop app is open |
anvil mcp | MCP server over stdio, e.g. claude mcp add anvil -- anvil mcp. Tools act on the current folder's application unless one is named; start/stop needs the desktop app open. Off by default: until you turn on Settings › Features › Agents (MCP), it says where to enable it and exits 1 |
anvil https <site> [--off] | Serve a site over HTTPS with http:// redirecting; --off reverts to HTTP only. Refused for Docker Compose projects and folders, which have no address |
anvil trust | Trust Anvil's local CA for your user: the login keychain on macOS, the user's Root store on Windows. Not on Linux yet |
anvil tld [suffix] | Show or set the domain suffix: localhost needs no resolver file, test needs setup's local domains step. On Linux only localhost works for now |
anvil uninstall [--yes] | List what Anvil changed. On macOS: its /etc/resolver files, the dev.anvil.ports daemon and its port forwarding rules, its CA in the System and login keychains, the PATH block in shell files, the login item, the app's ~/Library folders and ~/.anvil. On Windows: the Name Resolution Policy rule, its CA in the Root stores, the PATH entry, the login item and .anvil. --yes removes them (quit Anvil first) |
The desktop app
Anvil's desktop app: manage Laravel and other local apps, worktrees, logs, requests, mail, services, PHP versions and settings from one window.
Configuration
Reference for every field in ~/.anvil/config.toml: domain suffix, ports, default PHP, local HTTPS, per-application settings, services and worktrees.