ドキュメント

Unity command-line interface (CLI)

Unity Pipeline

Unity Hub

Download Unity Hub

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.
読み終わるまでの所要時間 11 分最終更新 4日前

注
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://unity.com/install.sh | 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:
To install to a different directory, set
UNITY_CLI_HOME
before you run the script. The script then installs the CLI to
<UNITY_CLI_HOME>/bin
(
<UNITY_CLI_HOME>\bin
on Windows) instead of the default location.
  • 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.

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. If a download is interrupted, the next
unity self-update
resumes the download instead of starting over. 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
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.

Create a project

To create a new Unity project:
  1. Open a terminal.
  2. Run
    unity projects create
    with a project name:
unity projects create MyGame
By default,
unity projects create
enables Unity Cloud for the new project and creates a Unity Cloud project entry in your organization. The command doesn't upload files, assets, or settings, and it doesn't store or host the local project anywhere. Because the default creates a cloud project, the command needs a signed-in user account. If you aren't signed in, the command stops with exit code 3 before creating anything and names both
unity auth login
and
--no-cloud
. The same applies when you authenticate as a service account because service accounts can't create projects in an organization.
To create a local-only project, pass
--no-cloud
unity projects create MyGame --no-cloud
To keep an entire pipeline local, set
UNITY_NO_CLOUD
for the job.
To use an existing Unity Cloud project instead of creating one, pass
--cloud-project <id-or-name>
. You can't combine
--no-cloud
with
--cloud
,
--cloud-org
, or
--cloud-project
. If the cloud setup doesn't complete, you keep the local project and the command reports a warning.
For all options, run
unity projects create --help
. For the other
projects
subcommands, 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

Set up version control

To add a Unity project to version control:
  1. Open a terminal in the project's directory.
  2. Run:
unity vcs setup
unity vcs setup
guides you through creating a repository and pushing the first commit. It detects available information, such as whether the project is already in a repository and which Git providers you have signed in to on the machine. It asks only for information it can't detect. Each guided run prints the flags that reproduce the selected configuration. Use
--save-preset <name>
to save those choices as the default for later runs. The command accepts the same
--git-*
flags as
unity projects link vcs
, so so you can skip the questions in scripted runs:
unity vcs setup --vcs github --git-namespace my-org --non-interactive
For the full command tree, including status and sync, repository audits, hooks, conflict resolution, and diffs, refer to Unity CLI reference.

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.

View long command output

Commands with long listings, such as
unity releases
,
unity editors
,
unity changelog
,
unity logs
, and the bare
unity command
listing, page human-readable output through a terminal pager when you run them in an interactive terminal. This prevents long lists from flooding your scrollback, similar to
git log
. Only human-readable output uses the pager: machine formats such as,
--format json
, piped or redirected output,
--quiet
, and commands run inside
unity shell
print directly:
unity releases
Set
UNITY_PAGER
or
PAGER
to use a different pager. Pass
--no-pager
to turn off paging for a single run, or set
UNITY_NO_PAGER
to turn off paging for all runs. If no pager is available, output prints directly instead of failing. his is common on Windows, where less isn't installed by default.