# Commands

> The castle commands you and your agent use, grouped by what they do, each with one line and an example. Public commands and common options only.

One line for each command, grouped by what it is for. Run `castle help` for the list on your own Mac.

## Connect and check

| Command | What it does |
|---|---|
| `castle integrate [claude\|codex\|all\|terminal]` | Connects Claude Code or Codex to Castle, or puts `castle` in your terminal. With no name it only looks. |
| `castle agents` | Says whether agents are allowed for all of Castle, and which devices have agents turned off. It only reads. |
| `castle doctor` | Checks Castle and your Mac and says what to do about anything wrong. |
| `castle show agents` | Opens Settings › Agents in Castle. It changes nothing. |
| `castle guide [topic]` | Prints the guide your agent reads. |

```
castle integrate claude
castle agents
```

## Use a device

| Command | What it does |
|---|---|
| `castle use [device] [--os …] [--for "…"]` | Asks for a device by kind, or picks the one you name. `--for` says what it is for. A bare `use` lists the ready devices. |
| `castle done [device] [--result "…"]` | Gives the device back. Castle keeps it as it is. |
| `castle status` | Shows how each device is being used, and how much room your Mac has. |
| `castle current` | Says which device is current, or that there is none. |

```
castle use --os ubuntu --for "check the OS version"
castle done --result "Checked: it is Ubuntu"
```

## Look and act

| Command | What it does |
|---|---|
| `castle observe [--text\|-i]` | Reads the screen. `--text` gives the words, `-i` lists what you can click. |
| `castle screenshot` | Takes a picture of the device's screen, never of your Mac's. |
| `castle open <address or app>` | Opens a web page or an app in the device. |
| `castle click`, `fill`, `type`, `press`, `scroll` | Click, fill in a field, type, press a key, scroll. |
| `castle find`, `wait` | Find something on the screen, or wait for it. |

```
castle open https://example.com
castle observe --text
```

## Work inside a device

| Command | What it does |
|---|---|
| `castle exec -- <command>` | Runs a command inside the device. |
| `castle fs push\|pull <from> <to>` | Moves a file into the device or out of it. |
| `castle app install <file>` | Installs an app in the device. |
| `castle apps list` | Lists the apps in the device. |
| `castle net probe <https address>` | Checks the device can reach an address. |
| `castle net forward <port>` | Opens a port in the device to your Mac. |

```
castle exec -- uname -a
castle fs pull /home/castle/results.txt ./results.txt
```

## Make, pause and remove devices

| Command | What it does |
|---|---|
| `castle device list` | Lists your devices and their state. |
| `castle device start`, `stop`, `restart` | Turns a device on or off. |
| `castle device pause`, `resume` | Saves a device to disk and gives its memory back, or brings it back. |
| `castle device duplicate [--from-snapshot …]` | Makes a copy of a device. |
| `castle device rename`, `remove --yes` | Renames or removes a device. Remove can't be undone. |
| `castle snapshot save\|list\|return\|rm` | Saves, lists, returns to or deletes a snapshot of a device. |

```
castle device list
castle snapshot save before-install
```

## Other agents

`castle mcp serve` runs Castle as an MCP server, for agent apps that use MCP. Connect Claude Code and Codex with `castle integrate` instead.

## Common options

| Option | What it does |
|---|---|
| `-d`, `--device <device>` | Which device the command is for. |
| `--json` | One result document, for scripts. |
| `-q`, `--quiet` | No output on success. |
| `--timeout <time>` | How long to let a command run. |
| `--wait <time>` | How long to wait for a device to be ready or wake. |
| `--yes` | Confirms something destructive. It never accepts a license for you. |

## Next

[Exit codes and errors](https://castle.cx/docs/command-line/exit-codes-and-errors.md).

---
Section: Command line · Last updated: 2026-11-20 · Source: https://castle.cx/docs/command-line/commands
