Installing the hzn CLI¶
The hzn command is the Open Horizon command line interface. When you install the Open Horizon agent software on an edge node, the hzn CLI is automatically installed. But you can also install the hzn CLI without the agent. For example, an edge administrator might want to query the Open Horizon exchange or an edge developer might want to test with hzn commands, without the full agent.
-
Get the agentInstallFiles-<edge-device-type>.tar.gz file from your management hub administrator, where <edge-device-type> matches the host where you installing
hzn. They were already created in Gather the necessary information and files for edge devices. Copy this file to the host where you are installing hzn. -
Set the file name in an environment variable for subsequent steps:
- Extract the
horizon_clipackage from theagentInstallFiles-<edge-device-type>.tar.gztar file:
-
Install the
horizon-clipackage: -
Confirm that the package version is the same as the device agent listed in Components.
-
On a debian-based distro:
-
On a RPM-based distro:
-
On macOS:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain horizon-cli.crt sudo installer -pkg horizon-cli-*.pkg -target / pkgutil --pkg-info com.github.open-horizon.pkg.horizon-cli # confirm version installedNote: On macOS, you can also install the horizon-cli pkg file from Finder: Double-click the file to open the installer. If you get an error message that says the program "cannot be opened because it is from an unidentified developer," right-click the file and select Open. Click Open again when prompted "Are you sure you want to open it?". Then, follow the prompts to install the CLI horizon package, ensuring your ID has administrator privileges.
Uninstalling the hzn CLI¶
If you want to remove the horizon-cli package from a host:
- Uninstall
horizon-clifrom a debian-based distro:
- Uninstall
horizon-clifrom an RPM-based distro:
- Or uninstall
horizon-clifrom macOS: