CLI

# Deploy from your terminal

`dhq` is the official DeployHQ command-line tool. Deploy, watch a deployment, read its logs and roll back from your terminal or your CI, with JSON output for scripts and AI agents. It is the recommended way to run deployments and automation.

`brew install deployhq/tap/dhq`Copy

[Read the CLI documentation](https://www.deployhq.com/support/cli)[No account yet? Try DeployHQ free](/signup?cta=CLI+try+free)

Terminal

$dhq deploy -p my-app --wait

✓ Deployed to production in 42s

# Something wrong? Read the logs, or roll back.

$dhq deployments logs dep-abc123 -p my-app

$dhq rollback dep-abc123 -p my-app

_Illustrative example_

## Install

HomebrewScriptScoopGo

### Homebrew

macOS and Linux.

TerminalCopy

```
brew install deployhq/tap/dhq
```

### Script

macOS and Linux. Downloads the installer from deployhq.com.

TerminalCopy

```
curl -fsSL https://www.deployhq.com/install/cli | sh
```

### Scoop

Windows.

PowerShellCopy

```
scoop bucket add deployhq https://github.com/deployhq/scoop-bucket
scoop install dhq
```

### Go

Any platform with Go installed.

TerminalCopy

```
go install github.com/deployhq/deployhq-cli/cmd/dhq@latest
```

You can also download a binary for Linux, macOS or Windows from the [GitHub releases page](https://github.com/deployhq/deployhq-cli/releases). Then run `dhq auth login` to sign in, or `dhq hello` for a guided setup.

## What you can do with it

- Deploy a project or a server, and watch it live with `--wait` (`dhq deploy`, `dhq deployments watch`)
- Read the logs of any deployment step (`dhq deployments logs`)
- Retry, abort or roll back a deployment (`dhq retry`, `dhq deployments abort`, `dhq rollback`)
- Manage projects, servers, server groups, environment variables, config files, SSH keys, build commands and scheduled deployments
- Get a quick dashboard across all your projects (`dhq status`) and open anything in the browser (`dhq open`)
- Call any API endpoint directly when there is no command for it yet (`dhq api`)

The CLI has more than 60 commands, and `dhq --help` lists them all. The full reference is in the [CLI documentation](https://www.deployhq.com/support/cli).

## Scripts, CI and AI agents

Every command can print JSON, and the CLI never has to ask a question when you run it non-interactively.

- `--json` prints machine-readable output, and `--json=name,status` picks only the fields you need
- `--non-interactive` fails with a clear error instead of waiting for a prompt
- `DEPLOYHQ_ACCOUNT`, `DEPLOYHQ_EMAIL` and `DEPLOYHQ_API_KEY` replace the interactive login in CI
- `dhq commands` and `--agent` describe the command set as JSON, so an agent can discover it
- `dhq skills install` teaches your AI coding agents, such as Claude Code, Cursor and Codex, to use `dhq`

CICopy

```
export DEPLOYHQ_ACCOUNT=your-account
export DEPLOYHQ_EMAIL=you@example.com
export DEPLOYHQ_API_KEY=your-api-key

dhq deploy -p my-app --wait --json
```

For agent setups, see [DeployHQ for AI agents](/agents).

## CLI, MCP or API

- **CLI:** recommended for deployments, rollbacks, logs and automation.
- **[Hosted MCP server](/mcp):** recommended for read-only access to accounts, projects, servers and deployment status from an AI assistant. It cannot deploy, change configuration or read deployment logs.
- **[REST API](/features/api):** for building your own integration.
- **[Local MCP package](https://www.deployhq.com/support/mcp-server):** still supported for now. It runs on your computer with an API key.

## Frequently Asked Questions

### Which platforms does the CLI support?

macOS, Linux and Windows, on amd64 and arm64. Install it with Homebrew, the install script, Scoop (Windows) or Go, or download a binary from the [GitHub releases page](https://github.com/deployhq/deployhq-cli/releases). Run `dhq update` to move to the latest release.

### How does it sign in?

Run `dhq auth login` to sign in interactively. The CLI keeps your credentials in your operating system's keyring when one is available, and otherwise in private files in the ~/.deployhq directory (readable only by you). In CI, or for an agent, set `DEPLOYHQ_ACCOUNT`, `DEPLOYHQ_EMAIL` and `DEPLOYHQ_API_KEY` instead, and no login is needed.

### Can I use it from CI or a script?

Yes. Set the three environment variables above, add `--json` for machine-readable output and `--non-interactive` so it never waits for a prompt, and use `--wait` to block until a deployment finishes.

### Which should I use: the CLI, the hosted MCP server or the API?

Use the CLI to deploy, roll back, read logs and automate. Use the [hosted MCP server](/mcp) when you only want an AI assistant to look at your projects, servers and deployment status. Use the [REST API](/features/api) when you are building your own integration. The [local MCP package](https://www.deployhq.com/support/mcp-server) is still supported for now.

### Does the CLI collect any data?

It sends anonymous usage telemetry unless you turn it off: the command name, exit code, duration, CLI version, operating system and architecture, and a sanitised one-line error summary on failure. It never collects your account, project or credentials. Error summaries can include command argument values, such as a branch name. Run `dhq telemetry disable`, or set `DEPLOYHQ_NO_TELEMETRY=1`, to turn it off.

### Is the CLI open source?

Yes. It is released under the MIT licence, and the source is on [GitHub](https://github.com/deployhq/deployhq-cli), where you can read the code, see the changelog and report issues.

[Read the CLI documentation](https://www.deployhq.com/support/cli)[No account yet? Try DeployHQ free](/signup?cta=CLI+try+free+bottom)

Last updated on 30th October 2026

