This section contains instructions for installing the command-line interface.
Package managers (recommended)
$ brew install TheThingsNetwork/lorawan-stack/ttn-lw-stack
Note: When installing with
brew, auto-completion is enabled automatically.
$ sudo snap install ttn-lw-stack $ sudo snap alias ttn-lw-stack.ttn-lw-cli ttn-lw-cli
Note: When installing with
snap, auto-completion is enabled automatically.
You can download pre-built binaries for your operating system and processor architecture.
The command-line needs to be configured to connect to your deployment on
thethings.example.com. You have multiple options to make the configuration file available to the CLI:
- Command-line flag:
- Save as
$XDG_CONFIG_HOME, your home directory, or the working directory.
NOTE: When using the snap packages,
~/.ttn-lw-cli.ymlwill fail with permission errors. Choose a different path.
Generate configuration file
For a standard deployment on
thethings.example.com, all you need is:
$ ttn-lw-cli use thethings.example.com [--fetch-ca] [--user] [--overwrite]
This will generate and save the required CLI config file. By default, the file is saved on the current directory, use the
--user to save it under the user config directory.
If the deployment is using a CA that is not already trusted by your system, use the
--fetch-ca flag to also connect to the server and retrieve the CA required for establishing secure communication.
NOTE: If the file exists already, it is not overwritten and an error is printed instead. You can use
--overwriteto overwrite the existing configuration file.
NOTE: You can also use the
--oauth-server-addressflags to override the default values for the gRPC port and the OAuth server address. These are not needed for standard deployments.
Manually creating configuration file
Alternatively, you can create a file named
.ttn-lw-cli.yml and paste the following contents:
oauth-server-address: 'https://thethings.example.com/oauth' identity-server-grpc-address: 'thethings.example.com:8884' gateway-server-grpc-address: 'thethings.example.com:8884' network-server-grpc-address: 'thethings.example.com:8884' application-server-grpc-address: 'thethings.example.com:8884' join-server-grpc-address: 'thethings.example.com:8884' device-claiming-server-grpc-address: 'thethings.example.com:8884' device-template-converter-grpc-address: 'thethings.example.com:8884' qr-code-generator-grpc-address: 'thethings.example.com:8884'
If your deployment uses a custom certificate authority, you’ll need to add:
For advanced options, see the Configuration Reference.
ttn-lw-cli complete to generate an auto-completion script for the
powershell shells are supported:
$ ttn-lw-cli complete --shell bash --executable ttn-lw-cli > ttn-lw-cli-autocomplete
Source the file to enable auto-completion:
$ . ./ttn-lw-cli-autocomplete
Alternatively, put in a default directory so that it is loaded automatically (This directory depends on your Operating System and your shell).
bash, this directory is typically
$ sudo cp ./ttn-lw-cli-autocomplete /etc/bash_completion.d/