cargo-install man page

cargo-install ā€” Install a Rust binary


cargo install [Options] <CRATE>

cargo install [Options] --list


Install a Rust binary

This command manages Cargo's local set of install binary crates. Only packages which have [[bin]] targets can be installed, and all binaries are installed into the installation root's bin folder. The installation root is determined, in order of precedence, by --root, $CARGO_INSTALL_ROOT, the install.root configuration key, and finally the home directory (which is either $CARGO_HOME if set or $HOME/.cargo by default).

There are multiple sources from which a crate can be installed. The default location is but the --git and --path flags can change this source. If the source contains more than one package (such as or a git repository with multiple crates) the argument is required to indicate which crate should be installed.

Crates from can optionally specify the version they wish to install via the --vers flags, and similarly packages from git repositories can optionally specify the branch, tag, or revision that should be installed. If a crate has multiple binaries, the --bin argument can selectively install only one of them, and if you'd rather install examples the --example argument can be used as well.

As a special convenience, omitting the <crate> specification entirely will install the crate in the current directory. That is, install is equivalent to the more explicit "install --path .".

If the source is or --git then by default the crate will be built in a temporary target directory. To avoid this, the target directory can be specified by setting the CARGO_TARGET_DIR environment variable to a relative path. In particular, this can be useful for caching build artifacts on continuous integration systems.

The --list option will list all installed packages (and their versions).


Query options


List all installed packages (and their versions).

Specifying what crate to install

--vers VERS

Specify a version to install from

--git URL

Git URL to install the specified crate from.

--branch BRANCH

Branch to use when installing from git.

--tag TAG

Tag to use when installing from git.

--rev SHA

Specific commit to use when installing from git.

--path PATH

Filesystem path to local crate to install.

Built and install options

-h, --help

Print this message.

-j N, --jobs N

Number of parallel jobs, defaults to # of CPUs.

--features FEATURES

Space-separated list of features to activate.


Build all available features.

-f, --force

Force overwriting existing crates or binaries


Do not build the default feature.


Build in debug mode instead of release mode.

--bin NAME

Only install the binary NAME.

--example EXAMPLE

Install the example EXAMPLE instead of binaries.

--root DIR

Directory to install packages into.

-v, --verbose

Use verbose output.

-q, --quiet

No output printed to stdout.

--color WHEN

Coloring: auto, always, never.

See Also

cargo(1), cargo-search(1), cargo-publish(1)

Referenced By

cargo(1), cargo-publish(1), cargo-search(1), cargo-uninstall(1).

May 2016 The Rust package manager Cargo Manual