LinuxCommandLibrary

cargo-install

Build and install Rust binary crates

TLDR

Install from crates.io

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

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

INSTALLATION ROOT

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

CAVEATS

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

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community