# The Gel CLI

The `gel` command-line interface (CLI) provides an idiomatic way to spin up local instances, open a REPL, execute queries, manage auth roles, introspect schema, create migrations, and more.

If you're using JavaScript or Python, our client libraries will handle downloading and running the CLI for you using tools like `npx` and `uvx`.

For everyone else, or if you wish to install the CLI globally, you can install using our bash installer or your operating system's package manager.

- Bash:
  ```bash
  $ curl https://www.geldata.com/sh --proto "=https" -sSf1 | sh
  ```
- Powershell:
  ```powershell
  PS> irm https://www.geldata.com/ps1 | iex
  ```
- Homebrew:
  ```bash
  $ brew install geldata/tap/gel-cli
  ```
- Nixpkgs:
  ```bash
  $ nix-shell -p gel
  ```
- JavaScript:
  ```bash
  $ npx gel --version
  ```
- Python:
  ```bash
  $ uvx gel --version
  ```

#### Connection options

All commands respect a common set of [connection options](https://docs.geldata.com/reference/using/cli/gel_connopts.md#ref-cli-gel-connopts), which let you specify a target instance. This instance can be local to your machine or hosted remotely.

#### Uninstallation

Command-line tools contain just one binary, so to remove it on Linux or macOS run:

```bash
$ rm "$(which gel)"
```

To remove all configuration files, run `gel info` to list the directories where Gel stores data, then use `rm -rf <dir>` to delete those directories.

If the command-line tool was installed by the user (recommended) then it will also remove the binary.

If you've used `gel` commands you can also delete [instances](https://docs.geldata.com/reference/using/cli/gel_instance/gel_instance_destroy.md#ref-cli-gel-instance-destroy) and [server](https://docs.geldata.com/reference/using/cli/gel_server/gel_server_uninstall.md#ref-cli-gel-server-uninstall) packages, prior to removing the tool:

```bash
$ gel instance destroy <instance_name>
```

To list instances and server versions use the following commands respectively:

```bash
$ gel instance status
$ gel server list-versions --installed-only
```

#### Configure CLI and REPL

You can customize the behavior of the `gel` CLI and REPL with a global configuration file. The file is called `cli.toml` and its location differs between operating systems. Use [gel info](https://docs.geldata.com/reference/using/cli/gel_info.md#ref-cli-gel-info) to find the "Config" directory on your system.

The `cli.toml` has the following structure. All fields are optional:

```default
[shell]
expand-strings = true         # Stop escaping newlines in quoted strings
history-size = 10000          # Set number of entries retained in history
implicit-properties = false   # Print implicit properties of objects
limit = 100                   # Set implicit LIMIT
                              # Defaults to 100, specify 0 to disable
input-mode = "emacs"          # Set input mode. One of: vi, emacs
output-format = "default"     # Set output format.
                              # One of: default, json, json-pretty,
                              # json-lines
print-stats = "off"           # Print statistics on each query.
                              # One of: off, query, detailed
verbose-errors = false        # Print all errors with maximum verbosity
```

[Notes on network usage](https://docs.geldata.com/reference/using/cli/network.md#ref-cli-gel-network)

