> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nerves-hub.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the nh CLI

> Install the nh CLI on macOS, Linux, or Windows using Homebrew, a prebuilt binary, or Go — no Elixir toolchain required.

The `nh` CLI is a standalone binary that lets you manage your NervesHub organization, devices, firmware, and deployment groups directly from the command line or inside CI/CD pipelines — no Elixir toolchain required. Choose the installation method that fits your operating system and workflow below.

## Install Options

<Tabs>
  <Tab title="macOS / Linux (Homebrew)">
    The quickest way to install `nh`. Homebrew also handles future upgrades.

    ```bash theme={null}
    brew install nerves-hub/tap/nh-cli
    ```

    To upgrade an existing installation:

    ```bash theme={null}
    brew upgrade nerves-hub/tap/nh-cli
    ```

    <Warning>
      The same tap also carries an older Elixir build of the CLI as `nerves-hub/tap/nh`, which provides its own `nh` command. If you have it installed, remove it first so the two do not collide:

      ```bash theme={null}
      brew uninstall nerves-hub/tap/nh
      ```
    </Warning>

    <Note>
      If macOS reports that the `nh` binary is not trusted after installation, open **System Settings → Privacy & Security**, scroll to the Security section, and click **Open Anyway** next to the `nh` entry. Then re-run `nh` in your terminal.
    </Note>
  </Tab>

  <Tab title="Prebuilt binary">
    Download an archive from the [latest release](https://github.com/nerves-hub/nh/releases/latest). Archives are named `nh_<version>_<os>_<arch>`, where `os` is `darwin`, `linux`, or `windows`, and `arch` is `amd64` or `arm64`. Windows archives are `.zip`; everything else is `.tar.gz`.

    <Steps>
      <Step title="Download the release archive">
        Pick the archive matching your OS and CPU — for example `nh_1.2.0_darwin_arm64.tar.gz` on Apple Silicon.
      </Step>

      <Step title="Extract the binary">
        Extract it to a directory of your choice, for example `C:\Tools\nh\` on Windows or `~/.local/bin/` on Linux and macOS.
      </Step>

      <Step title="Add to PATH">
        Add the directory containing the `nh` (or `nh.exe`) binary to your system `PATH` so it is available from any terminal.
      </Step>
    </Steps>
  </Tab>

  <Tab title="From source (Go)">
    Building `nh` yourself requires Go 1.26.4 or newer.

    ```bash theme={null}
    go install github.com/nerves-hub/nh@latest
    ```

    Or clone the repository and build it directly:

    ```bash theme={null}
    git clone https://github.com/nerves-hub/nh.git
    cd nh
    go build -o nh .
    mv nh /usr/local/bin/
    ```
  </Tab>
</Tabs>

## Verify Installation

After installing, confirm that `nh` is available and check the installed version:

```bash theme={null}
nh --version
```

To see top-level help and a summary of all available commands:

```bash theme={null}
nh --help
```

A successful installation prints the version string, for example:

```text theme={null}
nh version 0.x.y
```

## Runtime Dependency

Signing and uploading firmware shells out to [`fwup`](https://github.com/fwup-home/fwup), which must be on your `PATH`. No other command needs it, and it is not required when uploading with `--skip-signing`.

## Migrating from the Elixir CLI

If you previously used the Elixir `nerves_hub_cli`, import its settings once:

```bash theme={null}
nh migrate
```

This reads that CLI's data directory (`~/.nerves-hub`, or `$NERVES_HUB_HOME`) and copies your saved defaults, API token, and signing keys into `nh`'s own data directory. It leaves the original files in place, and signing keys are re-encoded rather than decrypted, so no key password is required and password-protected keys keep theirs.

<Note>
  `nh` is open source under the MIT license. View the source code, report issues, and track releases at [github.com/nerves-hub/nh](https://github.com/nerves-hub/nh).
</Note>
