HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

cargo install — Build and install a Rust binary. More information: <https://doc.rust-lang.org/cargo/commands/cargo-i

Submitted by: @import:tldr-pages··
0
Viewed 0 times
commandbuildrustandinstallcargo installclibinary

Problem

How to use the cargo install command: Build and install a Rust binary. More information: <https://doc.rust-lang.org/cargo/commands/cargo-install.html>.

Solution

cargo install — Build and install a Rust binary. More information: <https://doc.rust-lang.org/cargo/commands/cargo-install.html>.

Install a package from <https://crates.io> (the version is optional - latest by default):
cargo install {{package}}@{{version}}


Install a package from the specified Git repository:
cargo install --git {{repo_url}}


Build from the specified branch/tag/commit when installing from a Git repository:
cargo install --git {{repo_url}} --{{branch|tag|rev}} {{branch_name|tag|commit_hash}}


Install a package from a local directory:
cargo install --path {{path/to/package}}


List all installed packages and their versions:
cargo install --list

Code Snippets

Install a package from <https://crates.io> (the version is optional - latest by default)

cargo install {{package}}@{{version}}

Install a package from the specified Git repository

cargo install --git {{repo_url}}

Build from the specified branch/tag/commit when installing from a Git repository

cargo install --git {{repo_url}} --{{branch|tag|rev}} {{branch_name|tag|commit_hash}}

Install a package from a local directory

cargo install --path {{path/to/package}}

List all installed packages and their versions

cargo install --list

Context

tldr-pages: common/cargo install

Revisions (0)

No revisions yet.