cargo-install

Build and install Rust binary crates

TLDR

Install from crates.io
$ cargo install [ripgrep]
Install specific version
$ cargo install [[email protected]]
Install from git repository
$ cargo install --git [https://github.com/user/repo]
Install from local path
$ cargo install --path [.]
Force reinstall
$ cargo install --force [package]
List installed packages
$ cargo install --list
Install to custom location
$ cargo install --root [~/.local] [package]

SYNOPSIS

cargo install [options] crate[@version]...

DESCRIPTION

cargo install builds and installs Rust binary crates from crates.io, git repositories, or local paths. Binaries are installed to ~/.cargo/bin/ by default. Only packages with [[bin]] or [[example]] targets can be installed.

PARAMETERS

--version version

Version requirement (e.g., ~1.2, ^1.0)
--git url
Install from git repository
--branch branch
Git branch
--tag tag
Git tag
--rev sha
Git commit
--path path
Install from local path
--root dir
Installation directory
-f, --force
Overwrite existing binaries
--list
List installed packages
--bins
Install all binaries
--examples
Install all examples
--no-track
Don't save tracking information
--locked
Use Cargo.lock versions
-j, --jobs n
Parallel build jobs
--features features
Enable specified features
--all-features
Enable all features
--no-default-features
Disable the package's default feature set.
--target TRIPLE
Cross-compile binaries for the specified target triple.
--profile NAME
Build with the named profile (e.g., release, dev).
--debug
Build with the dev profile (faster compile, slower binary).

INSTALLATION ROOT

Determined by (in order): --root, CARGOINSTALLROOT, install.root config, CARGO_HOME, ~/.cargo

INSTALL

sudo apt install cargo
sudo dnf install cargo
sudo apk add cargo
sudo zypper install cargo
nix profile install nixpkgs#cargo

CAVEATS

Compiles from source (slow). For prebuilt binaries, use cargo-binstall. Updates require reinstalling with --force.

SEE ALSO

cargo(1), cargo-uninstall(1), cargo-binstall(1)