The recommended CLI tool for working with NervesCloud and self-hosted NervesHub platforms.
Features include:
- Uploading firmware to NervesHub
- Generating device certificates and registration
- Managing device provisioning metadata
- Creating and managing firmware signing keys
- Manage firmware deployments
- Manage user and organization accounts
brew install nerves-hub/tap/nhcurl --proto '=https' --tlsv1.2 -fsSL https://raw.githubusercontent.com/nerves-hub/nerves_hub_cli/master/install.sh | shThis installs the nh binary to /usr/local/bin.
Note
It's best practice to read any installation scripts before running them
If you are using a Mac and your get an error message that the binary isn't trusted, please follow these steps:
- Open the System Settings.
- Click on the "Privacy & Security" icon.
- Scroll down to the "Security" section.
- Click open next to the warning about the
nhexecutable. - Click on the "Open Anyway" button in the warning dialog.
- Run the
nhcommand again.
For more information, see the Apple Support article.
The CLI is a compiled binary that can be downloaded from the releases page.
Once downloaded you can run the binary directly, although we recommend adding it to your PATH so
that it's accessible across terminal sessions.
You can access available commands and documentation from the command-line using nh help. eg.
$ nh help
$ nh help device
When using the CLI, the default URI points to NervesCloud : https://manage.nervescloud.com.
To configure a different URI you can use:
$ nh config set uri "https://my.selfhosted.instance/"Finally, you need to authorize your account with the choosen platform by running:
$ nh user authThe CLI can be configured using environment variables to simplify automation.
The following variables are available:
NERVES_CLOUD_TOKEN/NERVES_HUB_TOKEN- Token used to authenticate API requestsNERVES_CLOUD_ORG/NERVES_HUB_ORG- Organization used for API requestsNERVES_CLOUD_PRODUCT/NERVES_HUB_PRODUCT- Product to used for API requestsNERVES_CLOUD_FW_PRIVATE_KEY/NERVES_HUB_FW_PRIVATE_KEY- Private key used for signing firmwareNERVES_CLOUD_FW_PUBLIC_KEY/NERVES_HUB_FW_PUBLIC_KEY- Public key used for verifying firmwareNERVES_CLOUD_DATA_DIR/NERVES_HUB_DATA_DIR- Directory used for storing config and signing keys (defaults to~/.nerves-cloud/~/.nerves-hub)NERVES_CLOUD_URI/NERVES_HUB_URI- Platform URI (defaults tohttps://manage.nervescloud.com)NERVES_CLOUD_NON_INTERACTIVE/NERVES_HUB_NON_INTERACTIVE- Force all yes/no user interaction to be yes
When you uninstall the CLI, it's highly recommended to run:
$ nh maintenance uninstall
Once you have run the above command you can safely delete the nh binary.