Twitch offers a command-line interface for managing Twitch resources. You can execute the commands in a terminal window or script.
Download and install the Twitch CLI
Depending on your operating system, use the following options to download and install the Twitch CLI. Both options add the CLI to your path.
If you have trouble installing or running the CLI, request help by posting a note in the #cli-help channel of the TwitchDev Discord server.
MacOS or Linux
To install the CLI on macOS or Linux, use Homebrew. Using Homebrew has the added benefit of managing versioning for you.
To install the CLI using Homebrew, run the following command from a terminal window:
brew install twitchdev/twitch/twitch-cli
To install the CLI on Windows, use Scoop. Using Scoop has the added benefit of managing versioning for you.
To install the CLI using Scoop, run the following command from a terminal window:
scoop bucket add twitch https://github.com/twitchdev/scoop-bucket.git scoop install twitch-cli
To download the CLI manually, go to Twitch CLI Releases. Scroll down to the Assets section of the page and click the link (.gz or .zip) for your OS and extract the files. You can use the checksum file to verify the executable, if needed. Make sure your system Path includes the path to the Twitch CLI binary (twitch) you downloaded.
Note: On macOS, if you’re not able to run commands, you may need to change the binary’s permissions to allow execution. From the binary’s folder, run:
chmod 755 twitch.
Twitch CLI Usage
After installing the Twitch CLI, open a terminal window and enter
twitch at the command prompt to display the CLI’s usage.
$ twitch A simple CLI tool for the New Twitch API and Webhook products. Usage: twitch [command] Available Commands: api Used to interface with the Twitch API configure Configures your Twitch CLI with your Client ID and Secret event Used to interface with Event services, such as Eventsub and Websub. help Help about any command mock-api Used to interface with the mock Twitch API. token Logs into Twitch and returns an access token according to your client id/secret in the configuration. version Returns the current version of the CLI. Flags: --config string config file (default is $HOME/.twitch-cli/.twitch-cli.env) -h, --help help for twitch Use "twitch [command] --help" for more information about a command.
Contributing changes to the CLI
To help make the CLI better, see CONTRIBUTING.
This library is licensed under the Apache 2.0 License.
The next step is to configure the CLI.
If you want to create a mock server and mock data that you can use to develop and test your application, see the mock-api command.