Use the Unity command-line interface (CLI)
Install the Unity CLI standalone binary and use it to install Editors, add modules, and open projects from a terminal.
阅读时间4 分钟最后更新于 1 天前
Use the Unity CLI to install Unity Editors, add modules, and manage projects from a terminal without the Unity Hub desktop application. The CLI is a standalone binary that works in CI pipelines, automation scripts, and terminal-first workflows.
The Unity CLI works well for:
- Continuous integration (CI) and build agents where installing the full Hub is undesirable.
- Scripting and automation that needs structured output (JSON or TSV) and predictable exit codes.
- Users who prefer a terminal-first workflow for everyday Hub tasks.
-- --headlessCommon Unity CLI tasks
The following commands cover the most common CLI tasks:unity --help # Top-level helpunity install lts # Install the latest LTS Editorunity install-modules -e 6000.3.7f1 -m ios # Add the iOS moduleunity editors -i # List installed Editorsunity open ./MyProject # Open a projectunity shell # Run many commands in one interactive sessionunity doctor # Print a diagnostic snapshot
Install the Unity CLI
To install the Unity CLI:- Open a terminal. On Windows, use PowerShell.
- Run the install script for your operating system.
curl -fsSL https://public-cdn.cloud.unity3d.com/hub/prod/cli/install.sh | UNITY_CLI_CHANNEL=beta bash
unity --versionPATH~/.local/bin/unityPATH~/.unityInstall from the Linux package repositories
On Linux, you can install the CLI from Unity's apt and rpm repositories instead of the install script, so your system package manager keeps it current. Beta releases publish to theunstablestableTo register the repository and install the CLI on Fedora or RHEL:curl -sL https://hub.unity3d.com/linux/keys/public | sudo gpg --dearmor -o /usr/share/keyrings/Unity_Technologies_ApS.gpgsudo tee /etc/apt/sources.list.d/unity-cli.sources <<'EOF'Types: debURIs: https://hub.unity3d.com/linux/repos/debSuites: unstableComponents: mainSigned-By: /usr/share/keyrings/Unity_Technologies_ApS.gpgEOFsudo apt update && sudo apt install unity-cli
If you install a release'ssudo tee /etc/yum.repos.d/unity-cli.repo <<'EOF'[unity-cli]name=Unity CLIbaseurl=https://hub.unity3d.com/linux/repos/rpm/unstableenabled=1gpgcheck=1gpgkey=https://hub.unity3d.com/linux/repos/rpm/unstable/repodata/repomd.xml.keyrepo_gpgcheck=1EOFsudo dnf install unity-cli
.deb.rpmapt upgradednf upgradeUpdate the Unity CLI
To update the CLI to the latest release:- Open a terminal.
- Run the self-update command:
The CLI replaces the current binary with the latest available release. The CLI also checks for updates in the background and prints a notice when a new release is available. To turn the check off, rununity upgrade
unity config update-check offunity upgradesudo apt update && sudo apt upgrade unity-cli # Debian and Ubuntu
sudo dnf upgrade unity-cli # Fedora and RHEL
Install a Unity Editor
To install a Unity Editor:- Open a terminal.
- Run with the version you want. Use a version alias such as
unity installor a specific version string such aslts:6000.3.7f1
The Editor downloads and installs to the configured install path. To add modules at install time, useunity install ltsunity install 6000.3.7f1
-mFor all options, version aliases, and module IDs, refer to Unity CLI reference.unity install lts -m ios android webgl
Add modules to an installed Editor
To add modules to an Editor you already installed:- Open a terminal.
- Run with
unity install-modulesfor the Editor version and-efor the module IDs:-m
The modules download and install for the specified Editor version.unity install-modules -e 6000.3.7f1 -m android ios
For all options and module IDs, refer to Unity CLI reference.
Open a project
To open a Unity project:- Open a terminal.
- Run with the path to the project:
unity open
Unity opens the project in the Editor version specified in the project's settings. You can omit theunity open ./MyProject
openunity ./MyProject
Sign in
To sign in to your Unity account:- Open a terminal.
- Run the login command, which opens a browser-based sign-in flow:
The CLI stores your session so you can use other commands without signing in again. To check whether you're signed in, rununity auth login
unity auth status