Skip to main content
nh is the command-line interface for NervesHub and NervesCloud. It is a single binary written in Go, so it needs no Elixir toolchain. It manages organizations, products, devices, firmware, archives, deployment groups and signing keys, and generates the X.509 certificates devices authenticate with.

Install

To upgrade later:
The same tap carries the older Elixir CLI as nerves-hub/tap/nh, which installs the same nh command. If you have it, remove it first:

Check the installation

Print the installed version:
A release build prints the version, then the commit and build date:
List the available commands:
Once you have set the server, check that nh can reach it. This needs no sign-in.

Tools nh calls

Most commands need nothing else installed. Signing depends on the firmware format. fwup is not needed when you pass --skip-signing. Without it, nh firmware upload --skip-signing warns that it cannot read the image’s metadata and uploads the file as it is. nh archive upload --skip-signing warns and leaves the metadata check to the server.

Migrate from the Elixir CLI

If you used the Elixir nerves_hub_cli, import its settings and keys:
nh migrate reads the old CLI’s data directory (~/.nerves-hub, or $NERVES_HUB_HOME) and copies into nh’s data directory:
  • Your saved API URI, organization, product and API token.
  • Your signing keys, from keys/<org>/ in the old directory to keys/<org>/ in the new one.
The old directory is only read, never changed. Signing keys are re-encoded, not decrypted, so you need no key password and password-protected keys keep theirs. Existing nh settings and keys are left alone unless you pass --force, so you can run it more than once. After migrating, run nh user whoami to confirm the token still works. If it does not, sign in again with nh user login.