Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Thursday, June 13, 2019

cargo-install (1)


cargo-install - Install a Rust binary


cargo install [OPTIONS] <CRATE>

cargo install [OPTIONS] --list


CARGO-INSTALL(1)                 Cargo Manual                 CARGO-INSTALL(1)

       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 installa-
       tion root is determined, in order of precedence, by --root,  $CARGO_IN-
       STALL_ROOT,  the  install.root  configuration key, and finally the home
       directory (which is either $CARGO_HOME if set or  $HOME/.cargo  by  de-

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

       Crates  from  crates.io can optionally specify the version they wish to
       install via the --vers flags, and similarly packages from git reposito-
       ries 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 exam-
       ples 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 crates.io or --git then by default the crate  will  be
       built  in  a temporary target directory.  To avoid this, the target di-
       rectory 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  ver-

   Query options
       --list List all installed packages (and their versions).

   Specifying what crate to install
       --vers VERS
              Specify a version to install from crates.io.

       --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 attributes(7) for descriptions of the following attributes:

       |Availability   | developer/rust/cargo |
       |Stability      | Volatile             |
       cargo(1), cargo-search(1), cargo-publish(1)

       This  work  is dual-licensed under Apache 2.0 and MIT terms.  See COPY-
       RIGHT file in the cargo source distribution.

       This software was built from source available at https://github.com/or-
       acle/solaris-userland.   The  original  community source was downloaded
       from  https://static.rust-lang.org/dist/rustc-1.28.0-src.tar.xz

       Further information about this software can be found on the open source
       community website at http://www.rust-lang.org/.

The Rust package manager           May 2016                   CARGO-INSTALL(1)