8

I installed several rust applications using:

cargo install fd-find sd ripgrep rga bat tealdeer exa git-delta du-dust

Is there any command like sudo apt update && sudo apt upgrade which I can use to update the packages.

Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87
  • Your are looking for https://docs.rs/cargo-update/7.0.1/cargo_update/index.html – Niklas Mohrin Jul 24 '21 at 12:37
  • Duplicate of [Does cargo install have an equivalent update command?](https://stackoverflow.com/questions/34484361/does-cargo-install-have-an-equivalent-update-command). Bash one-liner to update all rust packages: `cargo install $(cargo install --list | egrep '^[a-z0-9_-]+ v[0-9.]+:$' | cut -f1 -d' ')`. Credits to [David Bailey](https://stackoverflow.com/users/4247209/david-bailey) for [his answer](https://stackoverflow.com/a/66049504/1291371). – ilyazub Sep 14 '22 at 15:00
  • _One does not simply update all of their cargo packages._ – tmillr May 12 '23 at 03:21

2 Answers2

10

There is a optional subcommand cargo-update to do that:

cargo install cargo-update
cargo install-update -a

Done.

Stargateur
  • 24,473
  • 8
  • 65
  • 91
2

Cargo subcommand can be used for checking and applying updates to installed executables.

You can try cargo-update

cargo install cargo-update

General syntax

cargo install-update [OPTIONS] [PACKAGE…]

Update all installed packages :

cargo install-update -af

Update only selective packages :

cargo install-update fd-find sd ripgrep rga bat tealdeer exa git-delta du-dust

Reference : https://docs.rs/cargo-update/7.0.1/cargo_update/index.html

Karthik Balaguru
  • 7,424
  • 7
  • 48
  • 65