Cargo install update: how to update binary crates in Rust

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

«Cargo install» exists, but «cargo update» doesn't? A familiar pain for every Rust developer

\n\n

You just ran cargo install ripgrep to get the fresh rg binary. A week passes. You hear a new version is out — 14.1.0 instead of 13.0.0. And then a reasonable question arises: «Does cargo install have an equivalent update command?»

\n\n

This question has gathered thousands of views on Stack Overflow. And for good reason. The fact is that cargo has no built-in cargo install update command. No, you're not going blind. It really doesn't exist. But that doesn't mean you're doomed to manually download new versions. There are several approaches, and we'll cover them all — from simple to elegant.

\n\n

In this article, we won't just translate the Stack Overflow answer. We will compare approaches, show real code, and give actionable advice. Let's go!

\n\n

Why is there no «update» command in Cargo for installed crates?

\n\n

Before rushing to look for bugs, let's understand the philosophy. cargo install is designed for installing binary crates (those that have a [[bin]] section in their Cargo.toml). It is not a package manager like apt or npm. Cargo is first and foremost a build system and dependency manager for projects, not a global software installer.

\n\n

The cargo update command exists, but it works inside a project — it updates dependencies in Cargo.lock. For globally installed binaries, a different solution is needed.

\n\n

Method #1: Classic reinstallation (cargo install --force)

\n\n

The simplest and most obvious method is to reinstall the crate with the --force flag:

\n\n
# Installed the first time\ncargo install ripgrep\n\n# A week later — update\ncargo install --force ripgrep\n
\n\n

What happens under the hood? Cargo downloads the latest version of the crate from crates.io, rebuilds it, and replaces the binary. The --force flag forces overwriting the existing file, even if the version is the same.

\n\n

Pros:

\n
    \n
  • Does not require installing additional tools
  • \n
  • Works always and everywhere
  • \n
  • Intuitively clear
  • \n
\n\n

Cons:

\n
    \n
  • Full recompilation every time (slow if the crate is large)
  • \n
  • No check if a new version is available — you just reinstall
  • \n
  • Inconvenient if you have 10+ crates installed
  • \n
\n\n

It's like reinstalling Windows to update a driver. Does it work? Yes. Is it optimal? No.

\n\n

Method #2: cargo-outdated — a smart detector for outdated crates

\n\n

If you want to know for sure that an update is needed, install cargo-outdated:

\n\n
cargo install cargo-outdated\n
\n\n

Now check which crates are outdated:

\n\n
cargo outdated --root ~/.cargo\n
\n\n

The output will show something like:

\n\n
Package    Current  Latest  Deps\nripgrep    13.0.0   14.1.0  -\nbat        0.22.1   0.23.0  -\n
\n\n

Then you can update a specific crate using cargo install --force. But this is still two steps. Want automation? Read on.

\n\n

Pros:

\n
    \n
  • Shows only those crates that are actually outdated
  • \n
  • Works for project dependencies as well
  • \n
  • Has filtering options
  • \n
\n\n

Cons:

\n
    \n
  • Does not update itself — only informs
  • \n
  • Requires separate installation
  • \n
\n\n

Method #3: cargo-update (yes, such a crate exists!)

\n\n

The most elegant answer to the question «Does cargo install have an equivalent update command?» is

Blogs

Book Recommendations