文档

Development

User Acquisition

Monetization

工业

Unity command-line interface (CLI)

Download Unity Hub

Unity command-line interface (CLI)

此页面不支持所选语言。
​
​
Unity command-line interface (CLI)
  • Introduction to the Unity CLI
  • Use the Unity CLI
  • Unity CLI reference
  • Replace MCP Server with Unity CLI
  • Unity CLI release notes
  1. Unity command-line interface (CLI)

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.
阅读时间9 分钟
最后更新于 6 小时前

注意
The Unity CLI is experimental.
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.
For command syntax, options, and flags, refer to Unity CLI reference. If you have existing scripts that use the Hub CLI's
-- --headless
syntax, refer to Migrate from the Hub CLI for a comparison of syntax and behavior changes.
注意
To use the Unity CLI to control the Unity Editor, install and set up the Unity Pipeline package. For an example of how you can use the Unity CLI with Unity Pipeline, refer to the Unity CLI introduction video.

Compatibility

The Unity CLI is compatible with the following operating systems:
  • Windows 10 21H1 or newer.
  • Linux RHEL 9 and Ubuntu 22.04 and later. Requires glibc 2.34 or newer. Debian 11, CentOS 8, Amazon Linux 2 aren't supported.
  • macOS 14 and newer.
注意
You can install the Unity CLI on machines that don't run the Unity Hub desktop application, such as, headless CI workers. The CLI is also distributed as a Homebrew cask,
.deb
and
.rpm
packages, an AppImage, and an MSIX package on Windows. To learn more, refer to install with a package manager.

Common 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:
  1. Open a terminal. On Windows, use PowerShell.
  2. 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
After the script completes, verify the CLI is available by running
unity --version
. If the command isn't found, add the install directory to your shell's
PATH
or reopen your terminal.
On Linux, the script installs the binary to
~/.local/bin/unity
, which is on
PATH
by default on most distributions. Re-running the installer migrates an install from the previous
~/.unity
location.
注意
On Linux the install script and the
.deb
and
.rpm
packages check for glibc 2.34 or newer before installation. This means that an unsupported system uses the CLI it already has and doesn't replace it with one that can't start.
The install script above is the recommended way to install the Unity CLI. It always installs the latest release, and
unity self-update
keeps the CLI current after installation (refer to Update the Unity CLI). If you already manage command-line tools with a package manager, you can use one of the alternatives below:
  • Homebrew: update through that package manager instead of
    unity self-update
  • Linux package repositories: update through that package manager instead of
    unity self-update
  • winget: winget is the exception, it installs an MSIX package, so
    unity self-update
    keeps working

Install with a package manager

On macOS and Linux, you can install the CLI with Homebrew instead of the install script, so Homebrew keeps it current:
brew install --cask unity-cli
The cask supports Apple silicon and Intel on macOS, and x64 and arm64 on Linux. On Linux, installing casks requires Homebrew 6.0 or later.
To update the CLI, run
brew upgrade unity-cli
.
注意
The cask installs the command as
unity
. The cask name is
unity-cli
because
unity
refers to a different package in some package managers.
注意
If you already have a self-installed CLI from the install script and then install the Homebrew cask, the CLI warns you.
which unity
continues to resolve to the self-installed copy, while
brew upgrade
updates the other. The two installations can then drift apart. Run
unity self-uninstall -y
to remove the self-installed copy and let Homebrew manage updates.
On Windows, you can install the CLI with winget instead of the install script:
winget install Unity.CLI
To update the CLI, run
winget upgrade Unity.CLI
.
注意
winget shows the four-part package version, such as
1.0.0.20005
, because package versions can't include a prerelease tag.
unity --version
reports the full version, such as
1.0.0-beta.5
.
On Linux, you can install the CLI from Unity's apt and rpm repositories instead of using the install script. Your system package manager then keeps the CLI current. Beta releases are published to the
unstable
suite; general availability (GA) releases publish to
stable
.
To register the repository and install the CLI on Debian or Ubuntu:
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
To register the repository and install the CLI on Fedora or RHEL:
sudo 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
If you install a release's
.deb
or
.rpm
package file directly, the package registers the matching repository during installation, so
apt upgrade
or
dnf upgrade
keeps the CLI current from then on.
注意
The package installs the command as
unity
. The package name is
unity-cli
because
unity
refers to a different package on some distributions.

Update the Unity CLI

To update the CLI to the latest release:
  1. Open a terminal.
  2. Run the self-update command:
unity self-update
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, run
unity config update-check off
.
注意
unity upgrade
still works as an alias for
unity self-update
.
If you installed the CLI with Homebrew or from the Linux package repositories, update it through that package manager instead.
unity self-update
detects the package-managed install and shows the matching command. A winget install is the exception, since it's an MSIX package,
unity self-update
continues to update it directly.

Update with a package manager

brew upgrade unity-cli
winget upgrade Unity.CLI
注意
If you installed the CLI as an MSIX package, including through winget,
unity self-update
also updates it directly. it downloads only the parts of the package that changed and registers the install with Windows, so it stays current in the background. Rollback isn't available for MSIX installs.
sudo apt update && sudo apt upgrade unity-cli # Debian and Ubuntu
sudo dnf upgrade unity-cli # Fedora and RHEL
To see what the CLI resolved and which command updates your install, run:
unity diagnose update

Install a Unity Editor

To install a Unity Editor:
  1. Open a terminal.
  2. Run
    unity install
    with the version you want. Use a version alias such as
    lts
    or a specific version string such as
    6000.3.7f1
    :
unity install ltsunity install 6000.3.7f1
The Editor downloads and installs to the configured install path.
To add modules at install time, use
-m
followed by one or more module IDs:
unity install lts -m ios android webgl
For all options, version aliases, and module IDs, refer to Unity CLI reference.

Add modules to an installed Editor

To add modules to an Editor you already installed:
  1. Open a terminal.
  2. Run
    unity install-modules
    with
    -e
    for the Editor version and
    -m
    for the module IDs:
unity install-modules -e 6000.3.7f1 -m android ios
The modules download and install for the specified Editor version.
重要
You can only add modules to Editors installed through the Hub or the CLI. Reinstall manually installed Editors through the Hub or CLI before adding modules.
For all options and module IDs, refer to Unity CLI reference.

Open a project

To open a Unity project:
  1. Open a terminal.
  2. Run
    unity open
    with the path to the project:
unity open ./MyProject
Unity opens the project in the Editor version specified in the project's settings.
You can omit the
open
keyword when the first argument is a path:
unity ./MyProject

Sign in

To sign in to your Unity account:
  1. Open a terminal.
  2. Run the login command, which opens a browser-based sign-in flow:
unity auth login
The CLI stores your session so you can use other commands without signing in again.
To check whether you're signed in, run
unity auth status
. For all auth commands, refer to Unity CLI reference.

Sign in as a service account

For unattended workflows such as CI pipelines and build agents, you can authenticate with a service account. This is the same service account type used to sign into other Unity services, it isn't specific to the CLI. To learn how to create a service account, refer to Service accounts.
To sign in automatically through the Unity CLI, set the
UNITY_SERVICE_ACCOUNT_ID
and
UNITY_SERVICE_ACCOUNT_SECRET
environment variables to the account's key ID and secret key. For the full list of environment variables, refer to Unity CLI reference.

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • Compatibility

    • Common Unity CLI tasks

    • Install the Unity CLI

      • Install with a package manager

    • Update the Unity CLI

      • Update with a package manager

    • Install a Unity Editor

    • Add modules to an installed Editor

    • Open a project

    • Sign in

      • Sign in as a service account

  • 其他资源
  • Unity command-line interface (CLI) reference
  • command-line interface (CLI) overview
  • Service accounts

​
​