Skip to main content
Version: v2.x

Installing the Hasura CLI

Install a binary globally

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

Install through npm

Hasura CLI is available as an npm package that is independently maintained by some 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.

# 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]

(Optional) Add shell completion

To add command auto completion in the shell, refer to hasura completion.