The DeployHQ CLI (`dhq`) is a single binary with no runtime dependencies. It runs on macOS, Linux, and Windows.

## System Requirements

- macOS (Intel or Apple Silicon), Linux (x86_64 or ARM64), or Windows (x86_64 or ARM64)
- No Ruby, Node.js, or other runtime required

## Installation Methods

### Homebrew (macOS/Linux)

The recommended method for macOS and Linux:

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

### Install Script (macOS/Linux)

A one-liner that downloads the latest binary for your platform:

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

This is the recommended method for CI/CD environments where Homebrew is not available.

### Scoop (Windows)

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

### Go Install

If you have Go installed:

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

### Binary Download

Download the latest release for your platform from the [GitHub Releases page](https://github.com/deployhq/deployhq-cli/releases). Extract the binary and place it somewhere in your `PATH`.

## Verifying Installation

After installation, verify that the CLI is working:

```bash
dhq --version
```

Run the health check to verify your setup and connectivity:

```bash
dhq doctor
```

## Getting Started

The fastest way to get up and running is the guided onboarding command:

```bash
dhq hello
```

This walks you through logging in (or creating a new account), picking a project, and optionally running your first deployment -- all in one interactive flow.

## Updating

### Self-Update

The CLI can update itself:

```bash
dhq update
```

This uses Homebrew if available, otherwise downloads the latest release from GitHub.

### Homebrew Update

If you installed via Homebrew:

```bash
brew upgrade dhq
```

## Uninstalling

### Homebrew

```bash
brew uninstall dhq
```

### Manual

Remove the `dhq` binary from your `PATH` and optionally delete the configuration directory:

```bash
rm $(which dhq)
rm -rf ~/.deployhq
```

## Migrating from the Old Ruby Gem

The previous Ruby gem CLI (`deployhq`) is deprecated. To migrate:

1. Uninstall the old gem:

```bash
gem uninstall deployhq
```

2. Install the new CLI using any method above.

3. Authenticate with the new CLI:

```bash
dhq auth login
```

4. Set up your project:

```bash
cd /path/to/your-project
dhq configure
```

The new CLI stores credentials securely in your OS keyring instead of a `Deployfile`. Your old `Deployfile` is no longer needed, but keep it until you have confirmed the new CLI is working.

### Command Mapping

| Old (Ruby gem) | New (dhq) |
|----------------|-----------|
| `deployhq configure` | `dhq configure` |
| `deployhq servers` | `dhq servers list` |
| `deployhq deploy` | `dhq deploy --wait` |

## Troubleshooting

### "command not found" After Installation

Ensure the binary is in your `PATH`. Check with:

```bash
which dhq
```

If nothing is returned, add the installation directory to your `PATH`. For the install script, the default location is `/usr/local/bin/`.

### Permission Denied on macOS

If macOS blocks the binary, allow it in System Settings > Privacy & Security, or run:

```bash
xattr -d com.apple.quarantine $(which dhq)
```

### Doctor Fails

Run `dhq doctor` to diagnose issues. It checks:

- CLI version and update availability
- Authentication status
- API connectivity
- Configuration file validity
