Skip to main content
The toolkit hosts command group lets you add, remove, and inspect custom domain-to-IP mappings in your system hosts file. Unlike tools that write directly into the body of the file, Toolkit uses a labeled isolation block to contain every entry it manages. Your existing hosts file content is never touched — Toolkit’s entries live inside a clearly delimited section that you can inspect at any time, and the block is removed cleanly when all managed entries are gone.

toolkit hosts list

Lists all domain entries currently managed by Toolkit, along with a count of unmanaged system entries that exist outside the block. Syntax
Options Examples

toolkit hosts add

Adds a domain-to-IP mapping inside the Toolkit-managed block of your system hosts file. If the domain already exists in the managed block, the entry is updated. The rest of your hosts file is not modified. Syntax
Arguments Options Examples

toolkit hosts remove

Removes a managed domain from the Toolkit isolation block in your system hosts file. If no managed entries remain after the removal, Toolkit cleans up the block entirely. Syntax
Arguments Options Examples

Isolation mechanism

Toolkit never edits the native content of your hosts file. Instead, it inserts a self-contained block delimited by two marker comments. Everything outside this block remains exactly as you left it. After running toolkit hosts add my-app.local and toolkit hosts add api.local 192.168.1.50, your hosts file will contain a section that looks like this:
When you remove all managed entries, Toolkit deletes the block entirely, leaving your hosts file in a clean state.
On Windows and some Linux distributions, writing to the hosts file requires administrator or root privileges. If Toolkit cannot write to the file, it will report the error and prompt you to re-run the command with elevated permissions (e.g. sudo toolkit hosts add ... on macOS/Linux, or running your terminal as Administrator on Windows).