# Command line

Use the InboxSpec CLI in a terminal or test runner.

<a id="guide-content"></a>



First follow [client installation](https://www.inboxspec.com/docs/markdown/installation.md) and set your API address and project key in the terminal environment. The examples below also support a repository checkout.

<a id="alternative-cli-from-a-source-checkout"></a>

### Alternative: CLI from a source checkout

Run from the repository root. The function makes the commands in this guide available in the same Bash terminal.

```bash
bun install --frozen-lockfile
export INBOXSPEC_CHECKOUT="$PWD"
inboxspec() { bun run "$INBOXSPEC_CHECKOUT/packages/cli/src/bin.ts" "$@"; }
inboxspec --help
```

Run the [first-email recipe](https://www.inboxspec.com/docs/markdown/first-email.md), then use `inboxspec messages body "$MESSAGE_ID" --format text`. Wait exits 0 for a match, 1 for a timeout, 2 for invalid usage, 3 for authentication, 4 for limits and 5 for service failures. Ctrl+C cancels the client; do not retry indefinitely.
