2020-01-14 15:57:45 +03:00
|
|
|
.. meta::
|
|
|
|
:description: Install the Hasura CLI on Linux, Mac OS, Windows
|
|
|
|
:keywords: hasura, hasura cli, install, linux, mac, windows
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-03-28 13:51:58 +03:00
|
|
|
.. _install_hasura_cli:
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
Installing the Hasura CLI
|
|
|
|
=========================
|
|
|
|
|
2018-12-03 15:12:24 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2019-11-20 09:20:28 +03:00
|
|
|
Install a binary globally
|
|
|
|
-------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. rst-class:: api_tabs
|
|
|
|
.. tabs::
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. tab:: Linux
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
In your Linux shell, run the following command:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. code-block:: bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
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.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
If you'd prefer to install to a different location other than ``/usr/local/bin``, set the
|
2021-07-29 12:21:02 +03:00
|
|
|
``INSTALL_PATH`` variable accordingly:
|
2019-02-05 15:51:21 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. code-block:: bash
|
2019-02-05 15:51:21 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=$HOME/bin bash
|
2019-02-05 15:51:21 +03:00
|
|
|
|
2021-07-29 12:21:02 +03:00
|
|
|
You can also install a specific version of the CLI by providing the ``VERSION`` variable:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2021-09-07 10:48:58 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.0.9 bash
|
2021-07-29 12:21:02 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. tab:: Mac
|
2019-02-05 15:51:21 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
In your Terminal, run the following command:
|
2019-02-05 15:51:21 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. code-block:: bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
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.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
If you'd prefer to install to a different location other than ``/usr/local/bin``, set the
|
2021-07-29 12:21:02 +03:00
|
|
|
``INSTALL_PATH`` variable accordingly:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. code-block:: bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | INSTALL_PATH=$HOME/bin bash
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2021-07-29 12:21:02 +03:00
|
|
|
You can also install a specific version of the CLI by providing the ``VERSION`` variable:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2021-09-07 10:48:58 +03:00
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | VERSION=v2.0.9 bash
|
2021-07-29 12:21:02 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
.. tab:: Windows
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
Download the binary ``cli-hasura-windows-amd64.exe`` available under ``Assets`` of the latest release
|
|
|
|
from the GitHub release page: https://github.com/hasura/graphql-engine/releases
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-07-31 14:49:01 +03:00
|
|
|
Rename the downloaded file to ``hasura``.
|
|
|
|
You can add the path to the environment variable ``PATH`` for making ``hasura`` accessible globally.
|
2019-11-20 09:20:28 +03:00
|
|
|
|
|
|
|
Install through npm
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
Hasura CLI is available as an npm package that is independently maintained by some members of the community.
|
2020-05-05 10:05:44 +03:00
|
|
|
It can be beneficial to use the npm package if you want a version-fixed cli dedicated to your node.js project.
|
2020-07-09 11:42:33 +03:00
|
|
|
You can find usage details (e.g. flag information) in the `original repository <https://github.com/jjangga0214/hasura-cli>`__.
|
2019-11-20 09:20:28 +03:00
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
# install as a devDependency of your project
|
2020-05-05 10:05:44 +03:00
|
|
|
npm install --save-dev hasura-cli[@tag|@version]
|
2019-11-20 09:20:28 +03:00
|
|
|
|
|
|
|
# or install globally on your system
|
2020-05-05 10:05:44 +03:00
|
|
|
npm install --global hasura-cli[@tag|@version]
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
(Optional) Add shell completion
|
|
|
|
-------------------------------
|
|
|
|
|
2020-01-14 15:57:45 +03:00
|
|
|
To add command auto completion in the shell, refer to :ref:`hasura completion <hasura_completion>`.
|