Installing / Uninstalling the Hasura CLI
Installing the Hasura CLI
Installing through npm
The Hasura CLI is conveniently available as an npm package which wraps the compiled binary and is independently maintained by members of the community. It can be beneficial to use the npm package if you want a version-fixed CLI dedicated to your node.js project. You can find usage details (e.g. flag information) in the original repository. To install the CLI, you can use npm (or yarn):
# install as a devDependency of your project
npm install --save-dev hasura-cli[@tag|@version]
# or install globally on your system
npm install --global hasura-cli[@tag|@version]
Installing the Hasura CLI binary globally
If you prefer to install the binary globally, you can download it by following the instructions for your operating system:
- Linux
- Mac
- Windows
In your Linux shell, run the following command:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
This will install the Hasura CLI in /usr/local/bin. You might have to provide your sudo password depending on the
permissions of your /usr/local/bin location.
If you'd prefer to install to a different location other than /usr/local/bin, set the INSTALL_PATH variable
accordingly:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=$HOME/bin bash
You can also install a specific version of the CLI by providing the VERSION variable:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.2.0 bash
In your Terminal, run the following command:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
This will install the Hasura CLI in /usr/local/bin. You might have to provide your sudo password depending on the
permissions of your /usr/local/bin location.
If you'd prefer to install to a different location other than /usr/local/bin, set the INSTALL_PATH variable
accordingly:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=$HOME/bin bash
You can also install a specific version of the CLI by providing the VERSION variable:
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.2.0 bash
Download the binary cli-hasura-windows-amd64.exe available under Assets of the latest release from the GitHub
release page :
Rename the downloaded file to hasura. You can add the path to the environment variable PATH for making hasura
accessible globally.
To add command auto-completion in your shell, refer to the hasura completion command.
Uninstalling the Hasura CLI
Uninstalling through npm
If you installed the CLI as an npm package, use npm (or yarn):
# if installed as a project dependency
npm uninstall hasura-cli
# if installed as a global package
npm uninstall --global hasura-cli
Uninstalling a binary globally
If you installed the binary directly on your system, delete the binary file from its installation location.
# By default, the binary is installed at /usr/local/bin/hasura
$ which hasura
/usr/local/bin/hasura
# use sudo if required
$ rm /usr/local/bin/hasura

