Using the Unity Hub from the command line
The Unity Hub has a command line interface to allow you to access some Hub functionality in a headless mode. Note that this feature is still in Preview (experimental).
Before you can use these commands, download and install the 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
--errorsflag 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
macOS:
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless help
Windows:
C:\Program Files\Unity Hub> "Unity Hub.exe" -- --headless help
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
macOS:
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless editors -r
Windows:
C:\Program Files\Unity Hub> "Unity Hub.exe" -- --headless editors -r
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
|
-s
|
Sets your install path to the given path. |
--get
|
-g
|
Shows your current install path. |
Note: If you don't select an option, it defaults to the get command.
Examples
macOS:
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-path
-s /Applications/Unity/Hub/Editor/
Windows:
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install-path
-s /Applications/Unity/Hub/Editor/
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 Unity Editor if the version isn't in the release list. This information may be required if the version isn't in the release list: run editors -r to check. |
--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 |
This argument will automatically select to download all child modules, e.g. android module will download all 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 Unity Editor. Defaults to Intel, x86_64. |
Examples
macOS:
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install --version 2019.1.11f1 --changeset 9b001d489a54
Windows:
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install --version 2019.1.11f1 --changeset 9b001d489a54
Linux:
~/Applications/Unity\ Hub.AppImage --headless install --version 2019.1.11f1 --changeset 9b001d489a54
Install modules
To download and install a module to an installed Editor, use the install-modules command (alias: im).
The install-modules command supports the following options:
| Option | Alias | Required? | Usage | Description |
|---|---|---|---|---|
--version |
-v |
Yes | -v 2022.1.1f1 |
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 |
This argument automatically selects to download all child modules. For example, android module downloads all sub-modules. |
For the available modules, see the table below.
Note: Not all modules are available for every version of the Editor or for every OS.
Available modules
| Module | Value |
| 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
|
| Linux Build Support (Mono) | linux-mono
|
| Linux Build Support (IL2CPP) | linux-il2cpp
|
| WebGL Build Support | webgl
|
| Windows Build Support | windows
|
| Vuforia Augmented Reality support | vuforia-ar
|
| Language packs | language-ja, language-ko, language-zh-cn, language-zh-hant, language-zh-hans
|
| Windows Build Support (Mono) | windows-mono
|
| Lumin OS (Magic Leap) Build Support | lumin
|
| Microsoft Visual Studio Community 2017/2019 | visualstudio
|
| Visual Studio for Mac | visualstudio
|
| Mac Build Support (Mono) | mac-mono
|
| Mac Build Support (IL2CPP) | mac-il2cpp
|
| Universal Windows Platform Build Support | universal-windows-platform
|
| UWP Build Support (IL2CPP) | uwp-il2cpp
|
| UWP Build Support (.NET) | uwp-.net
|
Examples
macOS:
/Applications/Unity\ Hub.app/Contents/MacOS/Unity\ Hub -- --headless install-modules --version 2019.1.11f1 -m ios android
Windows:
C:\Program Files\Unity Hub>"Unity Hub.exe" -- --headless install-modules --version 2019.1.11f1 -m ios android
Linux:
~/Applications/Unity\ Hub.AppImage --headless install-modules --version 2019.1.11f1 -m ios android