cargo-uninstall
Remove previously installed Rust crates
TLDR
Remove an installed binary
SYNOPSIS
cargo uninstall [OPTIONS] <NAME>...
cargo uninstall [OPTIONS] --workspace
PARAMETERS
<NAME>...
One or more names of the packages to uninstall. These are the crate names, not necessarily the binary names.
--root <DIR>
Directory to uninstall from. Defaults to the Cargo home directory (typically ~/.cargo), meaning binaries are removed from ~/.cargo/bin.
--target <TRIPLE>
Uninstall binaries for the specified target triple (e.g., x86_64-unknown-linux-gnu), useful for cross-compiled installations.
--list, -l
Lists all currently installed packages and their associated binaries that were installed via cargo install, without performing any uninstallation.
--workspace
Uninstalls all binaries that belong to the current workspace and were previously installed using cargo install.
--verbose, -v
Use verbose output, showing more details about the uninstallation process.
--quiet, -q
Suppress all command output, showing only errors.
--color <WHEN>
Controls when colors are used in output. Possible values are auto (default), always, or never.
--frozen
Requires Cargo.lock to be up to date. If not, Cargo will exit with an error without attempting to update it.
--locked
Requires Cargo.lock to be up to date and fails if it is not. Equivalent to --frozen.
--offline
Runs without accessing the network. Fails if a network connection is required.
--help, -h
Prints help information about the command and its options.
DESCRIPTION
The cargo uninstall command is a subcommand of the Rust package manager, Cargo. It is used to remove local Rust binaries that were previously installed using the cargo install command.
When executed, cargo uninstall searches for the specified executable(s) within the Cargo home directory's bin subdirectory (typically ~/.cargo/bin or a custom directory specified by the CARGO_HOME environment variable or the --root option). It can uninstall one or more specific packages by name, or uninstall all binaries associated with the current workspace using the --workspace option.
This command plays a vital role in maintaining a clean and efficient Rust development environment, allowing developers to remove unneeded or outdated Rust tools and applications that have been installed globally or within a specific project context.
CAVEATS
cargo uninstall is designed exclusively for executables installed by cargo install. It will not remove binaries installed by other methods (e.g., system package managers or manual compilation). It also does not remove source code, build caches, or any other data not residing in the designated binary installation directory. Users must have appropriate file system permissions to modify the installation directory (e.g., ~/.cargo/bin).
ENVIRONMENT VARIABLES
The behavior of cargo uninstall can be influenced by standard Cargo environment variables, such as CARGO_HOME. This variable specifies the root directory where Cargo stores its binaries, registry, and other files. If CARGO_HOME is set, cargo uninstall will operate on that directory instead of the default ~/.cargo.
LISTING CAPABILITIES
The --list option is a powerful feature that allows users to quickly inspect which Rust executables have been installed via cargo install. This helps in identifying packages that might need to be uninstalled or updated, providing a clear overview of the installed Rust tools.
HISTORY
The cargo uninstall command, alongside cargo install, has been a core component of the Rust ecosystem since the early days of Cargo's development. Cargo, the official Rust package manager, was created to streamline project management, dependency resolution, and building processes for Rust applications. These commands provide a consistent and integrated way for developers to manage global or project-specific Rust tools and executables, reflecting Rust's commitment to developer convenience and ecosystem stability.
SEE ALSO
cargo(1), cargo-install(1), rustc(1), rustup(1)