Skip to content
86% off$349 $48.86code BF2026

Docs

Hermitbox docs29 pages

Automate Hermitbox: CLI, Shortcuts and links

Automate Hermitbox with the hermitbox CLI, hermitbox:// links and Shortcuts: every command, exit codes, name matching, and what automation can't do.

Updated 7 min read

On this page

This page shows you how to control Hermitbox VMs without clicking: with the Hermitbox CLI (the hermitbox command-line tool), hermitbox:// links and Shortcuts actions. It also covers how VM names are matched, what the exit codes mean, and what automation can't do.

All three work through the Hermitbox app. If Hermitbox isn't running, the command-line tool opens it in the background.

Install the Hermitbox CLI

The tool ships inside the app at Hermitbox.app/Contents/Helpers/hermitbox. Installing it puts a link to it in a folder on your PATH.

  1. Open Hermitbox and choose Hermitbox ▸ Settings… (⌘,).
  2. Click the Advanced tab.
  3. Under Command line tool, pick a location:
    • ~/.local/bin (the default). No password needed.
    • /usr/local/bin. This folder needs an administrator.
  4. Click Install.

If you chose /usr/local/bin and Hermitbox can't write there, it shows "That folder needs an administrator. Copy the command and run it in Terminal." Use Copy Command (or Run in Terminal) and enter your password in Terminal. The command is a sudo ln that creates the link.

The status line under the setting tells you where you stand:

StatusMeaning
"Installed. Try “hermitbox list”."Ready to use.
"Installed. Make sure ~/.local/bin is in your PATH."The link exists, but your shell may not find it yet (see below).
"Points to another copy of Hermitbox. Install to use this one."The link goes to a different copy of the app. Click Install to point it at this one.
"Another file named hermitbox is already there."Some other file with that name is in the way. Move it, or pick the other location.

To remove the tool, click Remove in the same place.

Add ~/.local/bin to your PATH

macOS doesn't include ~/.local/bin in PATH by default. With zsh (the default shell on current macOS), run:

bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc

This appends one line to ~/.zshrc. Open a new Terminal window for it to take effect. To undo it, delete that line from ~/.zshrc.

Check that it works:

bash
hermitbox version

Hermitbox CLI command reference

Run hermitbox help to see this list in Terminal.

CommandWhat it does
hermitbox list [--json]Lists your VMs and their state. Alias: ls.
hermitbox start NAME [--headless] [--disposable]Starts or resumes a VM.
hermitbox stop NAME [--force]Shuts the VM down by asking the guest. --force (or -f) pulls the plug, like Force Stop.
hermitbox suspend NAMESaves the VM's state to disk and stops it. The next start resumes it.
hermitbox pause NAMEFreezes the VM in memory.
hermitbox resume NAMEResumes the VM.
hermitbox open NAMEShows the VM's window.
hermitbox clone NAME [NEW_NAME]Makes an instant copy.
hermitbox snapshot create NAME [SNAPSHOT]Takes a snapshot. Alias: take.
hermitbox snapshot list NAMELists the VM's snapshots. Alias: ls.
hermitbox snapshot restore NAME [SNAPSHOT]Restores a snapshot. Alias: revert.
hermitbox snapshot delete NAME [SNAPSHOT]Deletes a snapshot. Alias: rm.
hermitbox ip NAMEPrints the VM's IP address.
hermitbox ssh [USER@]NAME [-- [SSH OPTIONS] [COMMAND]]Connects to the VM with ssh. -l USER works instead of USER@.
hermitbox versionPrints the version. Also -v.

--format json|text sets the output format. list --json gives you machine-readable output for scripts.

Rules for start, stop and clone

  • start --headless runs the VM without a window. Open its window later with hermitbox open NAME or from the menu bar.
  • start --disposable starts a throwaway copy, the same as Run Without Saving Changes: everything that changed is discarded when it stops. You can't combine --disposable with --headless. A disposable macOS VM counts toward the limit of two macOS VMs at a time.
  • start on a template doesn't start the template itself. It creates a copy named "NAME 2" without asking.
  • stop without --force lets the guest shut down normally. --force is like pulling the plug, so unsaved work in the VM is lost.
  • clone needs the VM shut down or suspended. The copy gets a new id and MAC address, and no snapshots or saved state.

How VM names are matched

Wherever a command takes NAME:

  • Matching is case-insensitive: ubuntu matches "Ubuntu".
  • A unique prefix is enough: ubu works if no other VM name starts with "ubu". If a prefix matches more than one VM, type more of the name.
  • You can also pass the VM's id.

Quote names that contain spaces:

bash
hermitbox start "macOS 15 Test"

Exit codes and error messages

CodeMeaning
0Success.
1Error. The message is printed to stderr.
64Usage error (wrong command or arguments).
69Hermitbox couldn't be reached.

Messages you may see on stderr:

MessageWhat to do
"Hermitbox couldn't be opened. Is it installed?"Make sure Hermitbox is in your Applications folder and opens normally.
"Hermitbox opened but didn't answer. Try again in a moment."Hermitbox was still launching. Run the command again.
"No VMs yet. Create one in Hermitbox."Create a VM in the app first. The CLI can't create VMs.
"No IP address yet."The VM is still starting up. Wait a few seconds and retry.
"The control socket belongs to another user."Run the command as the same macOS user that runs Hermitbox.

The CLI talks to the app over a private Unix socket at ~/Library/Application Support/Hermitbox/Control/control.sock, which only your user can open. Nothing listens on the network.

Script snapshots and SSH

Take a snapshot before a risky change

bash
hermitbox snapshot create ubuntu "before-upgrade" && echo "Snapshot taken"

If the VM is running, Hermitbox suspends it briefly, takes the snapshot and resumes it. On an APFS disk the snapshot is instant and takes no space until the VM changes; on other disks it's a full copy. Snapshots aren't available for disposable runs.

To roll back:

bash
hermitbox snapshot restore ubuntu "before-upgrade"

snapshot restore always snapshots the current state first, so a scripted restore never throws away the state you were in. Remove snapshots you no longer need with hermitbox snapshot delete.

Wait for a VM's IP address, then connect

A VM that has just started may not have an address yet. hermitbox ip fails until it does, so you can loop on it:

bash
hermitbox start ubuntu --headless
until ip=$(hermitbox ip ubuntu 2>/dev/null); do sleep 2; done
echo "Ubuntu is at $ip"

This loop waits forever if the VM never gets an address, so stop it with Control-C (⌃C) if it hangs.

Then run a command in the VM over SSH:

bash
hermitbox ssh dev@ubuntu -- uptime

Everything after -- goes to ssh: options first, then the command to run in the VM. Leave it out to get an interactive session. Hermitbox stores no SSH passwords; ssh handles authentication with your keys as usual.

Start, test, stop

bash
#!/bin/zsh
hermitbox start build-box --headless || exit 1
until hermitbox ip build-box >/dev/null 2>&1; do sleep 2; done
hermitbox ssh build-box -- ./run-tests.sh
result=$?
hermitbox stop build-box
exit $result

The script saves the test result before shutting the VM down, so the VM stops even when the tests fail, and the script still exits with the tests' exit code.

Links let you start or stop a VM from anything that opens URLs: a note, a launcher, a web page, or Terminal with open.

The format is:

text
hermitbox://ACTION?name=VM

You can use id= or vm= instead of name=.

ActionWhat it does
startStarts or resumes the VM. Add &headless=1 to run it without a window.
openShows the VM's window.
stopShuts the VM down. Alias: shutdown.
suspendSaves the state and stops the VM.
pauseFreezes the VM in memory.
resumeResumes the VM.

Examples:

bash
open "hermitbox://start?name=Ubuntu&headless=1"
open "hermitbox://suspend?name=Ubuntu"

open hands the link to Hermitbox, the same as clicking it. In a link, write spaces in a VM name as %20 (for example name=macOS%2015%20Test).

Links can't force-stop a VM, take snapshots, clone, or start disposable runs. Use the CLI or the app for those. If a link is malformed or asks for something links can't do, Hermitbox shows an alert that says why.

Shortcuts actions

Hermitbox adds these actions to the Shortcuts app. The VM parameter is searchable by name.

ActionParametersWhat it does
Start Virtual MachineVM; Show Window (on by default)Starts or resumes the VM. Turn off Show Window to run it in the background.
Shut Down Virtual MachineVM; Force Stop (off by default)Shuts the VM down, or pulls the plug if Force Stop is on.
Suspend Virtual MachineVMSaves the state and stops the VM.
Take SnapshotVM; optional NameTakes a snapshot.
Get IP Address of Virtual MachineVMReturns the VM's IP address.
Get Running Virtual MachinesNoneReturns the VMs that are running.

Hermitbox also registers App Shortcuts, so you can ask Siri with phrases such as "Start a VM in Hermitbox".

For example, chain Start Virtual Machine with Show Window off, then Get IP Address of Virtual Machine, then Copy to Clipboard to start a server VM and have its address ready to paste.

What automation can't do

  • Create VMs. There's no create command, link or Shortcuts action. Create VMs in the app with File ▸ New VM… (⌘N), then automate them.
  • Change VM settings. Cores, memory, disks, display, network and sharing are changed in the app, in the VM Settings window or the inspector.
  • Use AppleScript. Hermitbox has no AppleScript dictionary. From AppleScript you can call the CLI with do shell script, using the tool's full path (for example ~/.local/bin/hermitbox list), because it doesn't read your shell's PATH.
  • Force-stop, snapshot, clone or start disposable runs from links. The CLI can do all of these. Shortcuts can force-stop and take snapshots.
  • Control Hermitbox from another device. There's no network server, web dashboard or iOS app. The CLI only talks to Hermitbox on the same Mac, as the same user.
  • Get around Apple's limits. Automation follows the same rules as the app, including the limit of two macOS VMs running at once.

Every app.
One purchase.