LinuxCommandLibrary

cargo-uninstall

Remove previously installed Rust crates

TLDR

Remove an installed binary

$ cargo uninstall [package_spec]
copy

SYNOPSIS

cargo uninstall [<OPTIONS>] [<CRATES>...]

PARAMETERS

-h, --help
    Print help information

--dry-run
    Print what would be removed without actually removing

-q, --quiet
    Do not print cargo log messages

-v, --verbose <LEVEL>
    Number of log levels to display [default: 0] (e.g., -vv for very verbose)

--color <WHEN>
    Control when colored output is used [default: auto] [values: auto, always, never]

--root <ROOT>
    Directory for all generated artifacts and the .cargo directory

<CRATES>...
    Names of crates/binaries to uninstall (positional arguments)

DESCRIPTION

cargo uninstall is a subcommand of Cargo, Rust's package manager and build tool. It removes one or more Rust binaries (executables) previously installed system-wide using cargo install. These binaries are typically placed in $HOME/.cargo/bin, added to your PATH for global access.

When invoked, it identifies the specified crate's binaries from the installation manifest and deletes them. Multiple crates can be uninstalled in one command. It does not affect dependencies, source code, or workspace crates—only the direct binaries from cargo install.

Use --dry-run to preview removals without changes. The command respects Cargo's configuration, including custom roots or registries. Errors occur if a crate isn't installed or binaries are missing.

Ideal for cleaning up unused tools like ripgrep or starship, keeping your Cargo-managed toolchain tidy.

CAVEATS

Only removes binaries from cargo install; ignores dependencies, source, or non-Cargo installs. Fails if crate not found.

EXAMPLES

cargo uninstall ripgrep
cargo uninstall --dry-run starship bat
cargo uninstall -q $(cargo install --list | cut -d' ' -f1)

LOCATION

Binaries removed from $CARGO_HOME/bin or $HOME/.cargo/bin by default.

HISTORY

Added in Cargo 0.19.0 (July 2017) as Rust ecosystem matured. Developed by Rust Project; evolved with Cargo's config system.

SEE ALSO

Copied to clipboard