# Use the Hub CLI

> Install and manage Unity Editors and modules from the terminal with the Hub Command line interface (CLI) in headless mode.

> **Note:**
>
> This feature is experimental. The CLI might not include every feature available in the Hub UI.

Use the Hub command line interface (CLI) to install Unity Editors, add modules, and manage Editor installations from a terminal. The Hub CLI is part of the Unity Hub desktop application and runs in headless mode.

For command options, flags, and module IDs, refer to [Hub CLI reference](./hub-cli-reference.md).

## Prerequisites

Before you use the Hub CLI perform the following steps:

1. [Download and install the Hub](./install-hub.md).
2. Locate the Hub executable on your machine:
   * **macOS:** `/Applications/Unity Hub.app/Contents/MacOS/Unity Hub`
   * **Windows:** `C:\Program Files\Unity Hub\Unity Hub.exe` (or your install location)
   * **Linux:** path to your `Unity Hub.AppImage` or installed binary

## Run the Hub CLI

Send headless commands to the Hub executable from your terminal.

* On **Windows** and **macOS**, place `-- --headless` before the command.
* On **Linux**, place `--headless` before the command.

The following examples replace the Hub executable path with the path on your machine.

## Display help

To list available CLI commands and flags:

1. Open a terminal.
2. Run the help command for your operating system.

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
```

```shell title="Windows"
C:\Program Files\Unity Hub> "Unity Hub.exe" -- --headless help
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless help
```

## List available and installed Editors

To list available releases or installed Editors:

1. Open a terminal.
2. Run the `editors` command with the scope you need (`-r` for releases, `-i` for installed, or `-a` for both). For all options, refer to [Manage Editors](./hub-cli-reference.md#manage-editors).

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors -r
```

```shell title="Windows"
C:\Program Files\Unity Hub> "Unity Hub.exe" -- --headless editors -r
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless editors -r
```

## Set or get the Editor install path

To set or get the path where Unity Editors are installed:

1. Open a terminal.
2. Run `install-path` with `-s` and a path to set the install location, or `-g` to show the current path. If you omit options, the command uses `get`. For all options, refer to [Set/Get install path](./hub-cli-reference.md#set/get-install-path).

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-path -s /Applications/Unity/Hub/Editor/
```

```shell title="Windows"
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install-path -s "C:\Program Files\Unity\Hub\Editor\"
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless install-path -s /Applications/Unity/Hub/Editor/
```

## Install a Unity Editor

To install a new Editor from the releases list or archive:

1. Open a terminal.
2. Run the `install` command with `--version` and the Editor version. Add `--changeset` if the version is not in the release list (check with `editors -r`). For all options, refer to [Install Unity Editors](./hub-cli-reference.md#install-unity-editors).

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 6000.3.7f1 --changeset 9b001d489a54
```

```shell title="Windows"
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install --version 6000.3.7f1 --changeset 9b001d489a54
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless install --version 6000.3.7f1 --changeset 9b001d489a54
```

## Install modules on an installed Editor

To add modules to an Editor you installed through the Hub:

1. Open a terminal.
2. Run `install-modules` with `--version` for the installed Editor and `-m` with one or more [module IDs](./hub-cli-reference.md#available-modules).

> **Important:**
>
> You can only add modules to Editors you installed through the Hub. If you installed an Editor manually, reinstall it through the Hub before you add modules.

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 6000.3.7f1 -m ios android
```

```shell title="Windows"
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install-modules --version 6000.3.7f1 -m ios android
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless install-modules --version 6000.3.7f1 -m ios android
```

## Install an Editor with modules

To install a new Editor and modules in one command:

1. Open a terminal.
2. Run the `install` command with `--version` and `--module` (or `-m`) followed by one or more module IDs from [Hub CLI reference](./hub-cli-reference.md#available-modules).

```shell title="macOS"
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 6000.3.7f1 --module android android-sdk-ndk-tools android-open-jdk
```

```shell title="Windows"
"C:\Program Files\Unity Hub\Unity Hub.exe" -- --headless install --version 6000.3.7f1 --module android android-sdk-ndk-tools android-open-jdk
```

```shell title="Linux"
~/Applications/Unity\ Hub.AppImage --headless install --version 6000.3.7f1 --module android android-sdk-ndk-tools android-open-jdk
```
