# Hub CLI reference

> The Unity Hub has a command-line interface to allow you to access some Hub functionality in headless mode.

> **Note:**
>
> This feature is experimental and full feature parity with the Hub UI is not guaranteed.

Before you can use these commands, [download and install the Hub](./install-hub).

## Global flags

Flag: `--errors`

As of **Hub 3.7.0-beta.1**:

* Some errors are hidden by default from the console output.
* Use the `--errors` flag in the command to bring those errors back to the output.

## Display help

From your terminal, navigate to the location of the Hub app executable and run the command `-- --headless help` or `-- --headless h` (note the one `--` for Linux and the `-- --` for the other operating systems).

The help command allows you to access the list of available CLI commands and the different flags and argument types.

### Examples

```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
```

## Manage Editors

To display a combined list of the available releases and installed Editors on your machine, use the `editors` (alias: `e`) command.

To reduce the scope of the list, specify one of the following options:

| Option        | Alias | Description                                                             |
| ------------- | ----- | ----------------------------------------------------------------------- |
| `--all`       | `-a`  | Displays both available releases and Editors installed on your machine. |
| `--releases`  | `-r`  | Displays the available releases.                                        |
| `--installed` | `-i`  | Displays the Editors installed on your machine.                         |

### Examples

```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/Get install path

To set or get the path where you have installed the Unity Editors on your machine, use the `install-path` command (alias: `ip`).

This `install-path` command supports the following options:

| Option         | Alias | Description                                     |
| -------------- | ----- | ----------------------------------------------- |
| `--set <path>` | `-s`  | Sets the Editor install path to the given path. |
| `--get`        | `-g`  | Displays the current Editor install path.       |

> **Note:**
>
> If you don't select an option, it defaults to the `get` command.

### Examples

```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 /Applications/Unity/Hub/Editor/
```

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

## Install Unity Editors

To install a new Editor either from the releases list or archive, use the `install` command (alias: `i`).

The `install` command supports the following options:

| Option           | Alias  | Required? | Usage                                                 | Description                                                                                                                                                               |
| ---------------- | ------ | --------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--version`      | `-v`   | Yes       | `-v 2022.1.1f1`                                       | The Editor version to install.                                                                                                                                            |
| `--changeset`    | `-c`   | No        | `-c 9b001d489a54`                                     | The changeset of the Editor. This information might be required if the version isn't in the release list. To check if a version is in the release list, run `editors -r`. |
| `--module`       | `-m`   | No        | `-m android` or `-m appletv webgl`                    | The module ID. Accepts multiple module IDs. Refer to the `install-modules` command for more information.                                                                  |
| `--childModules` | `--cm` | No        | `--cm`                                                | Ensures any child modules of the specified `--module` are also downloaded. For example, `-m android -cm` downloads all Android sub-modules.                               |
| `--architecture` | `-a`   | No        | `-a arm64` for Apple Silicon or `-a x86_64` for Intel | macOS only: Use this argument to explicitly choose between the Apple Silicon or Intel version of the Editor. Defaults to Intel, `x86_64`.                                 |

### Examples

```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

To download and install a module to an installed Editor, use the `install-modules` command (alias: `im`).

> **Important:**
>
> You can only add modules to an Editor that you installed through the Hub. If you installed an Editor manually, you must reinstall it through the Hub to be able to add modules to it. You can perform a headless reinstallation of an Editor with the `install` command and the `--module` option to add modules during installation. For more information, refer to the [Install Editor with modules](#install-editor-with-modules) section.

The `install-modules` command supports the following options:

| Option           | Alias  | Required? | Usage                              | Description                                                                                                                                 |
| ---------------- | ------ | --------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `--version`      | `-v`   | Yes       | `-v 6000.3.7f1`                    | Specifies the version of the installed Editor to add the module to.                                                                         |
| `--module`       | `-m`   | Yes       | `-m android` or `-m appletv webgl` | Specifies the module ID. You can add more than one module at a time.                                                                        |
| `--childModules` | `--cm` | No        | `--cm`                             | Ensures any child modules of the specified `--module` are also downloaded. For example, `-m android -cm` downloads all Android sub-modules. |

### Available modules

The following table lists modules available for installation. You can also view this list by [displaying help](#display-help).

> **Important:**
>
> Not all modules are available for every version of the Editor or on every platform. The definitive list of available modules for your Editor version and platform is shown in the Hub UI when you select **Manage** > **Add Modules** on a specific Editor installation in the **Installs** window. For more information, refer to [Add modules to a Unity Editor installation](./add-modules).

| Module                                   | Module ID                                                                      |
| ---------------------------------------- | ------------------------------------------------------------------------------ |
| Documentation                            | `documentation`                                                                |
| Android Build Support                    | `android`                                                                      |
| Android SDK & NDK Tools                  | `android-sdk-ndk-tools`                                                        |
| OpenJDK                                  | `android-open-jdk`                                                             |
| iOS Build Support                        | `ios`                                                                          |
| tvOS Build Support                       | `appletv`                                                                      |
| Language packs                           | `language-ja, language-ko, language-zh-cn, language-zh-hant, language-zh-hans` |
| Linux Build Support (Mono)               | `linux-mono`                                                                   |
| Linux Build Support (IL2CPP)             | `linux-il2cpp`                                                                 |
| Lumin OS (Magic Leap) Build Support      | `lumin`                                                                        |
| Microsoft Visual Studio                  | `visualstudio`                                                                 |
| Mac Build Support (Mono)                 | `mac-mono`                                                                     |
| Mac Build Support (IL2CPP)               | `mac-il2cpp`                                                                   |
| Mac Dedicated Server Build Support       | `mac-server`                                                                   |
| Universal Windows Platform Build Support | `universal-windows-platform`                                                   |
| UWP Build Support (IL2CPP)               | `uwp-il2cpp`                                                                   |
| UWP Build Support (.NET)                 | `uwp-.net`                                                                     |
| Web Build Support                        | `webgl`                                                                        |
| Windows Build Support (Mono)             | `windows-mono`                                                                 |
| Windows Build Support (IL2CPP)           | `windows-il2cpp`                                                               |
| Windows Dedicated Server Build Support   | `windows-server`                                                               |

> **Note:**
>
> You must always specify a specific version with the `--version` command when installing Android modules.

### Examples

```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 Editor with modules

You can only install modules with the Hub command-line interface if the Editor was also installed through the Hub. It can be convenient to install an Editor and modules together at the same time. To install a new Editor with modules, use the `install` command in combination with the `--module` (alias: `-m`) option.

### Examples

```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
```

## Log locations

To view the Hub logs, do one of the following:

* Go to **Account** > **Help and Support** > **Logs**.
* Navigate to one of the following locations on your system:
  * Windows: `%UserProfile%\AppData\Roaming\UnityHub\logs`
  * Mac: `~/Library/Application\ Support/UnityHub/logs`
  * Linux: `~/.config/UnityHub/logs`
