CARGO-UPDATE(1)

πŸ“¦ version 1.76.0, in ubuntu jammy, ubuntu noble

✨ CARGO-UPDATE(1) ✨

okay bestie, welcome to the General Commands Manual page for cargo-update πŸŽ€ this is the one that refreshes your dependency glow-up. pull up a chair, we're doing this together πŸ’–


🌸 NAME 🌸

cargo-update β€” update dependencies as recorded in the local lock file πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

cargo update [options] spec

πŸ’… DESCRIPTION πŸ’…

This command updates the dependencies in your Cargo.lock file to the latest version. no cap. ✨

And if the Cargo.lock file doesn't even exist yet? Not a problem, bestie β€” it will be created for you, with the latest available versions. it's giving manifesting πŸ’«


🌈 OPTIONS 🌈

πŸ’– Update Options πŸ’–

  • spec… β€” Update only the packages you name. This flag may be specified multiple times, so go off, list as many as you want 🫢 See cargo-pkgid(1) for the SPEC format.

If packages are specified with spec, then a conservative update of the lockfile happens. Translation: only the dependency specified by SPEC gets updated, bestie. Its transitive dependencies will be updated only if SPEC can't be updated without updating dependencies. Everything else stays locked at the versions currently recorded. no unnecessary drama πŸ’…

If spec is not specified, then literally all the dependencies are updated. periodt.

  • --recursive β€” When used with spec, the dependencies of spec are forced to update as well. Cannot be used with --precise. 🚫 (these two do NOT get along, okay?)
  • --precise precise β€” When used with spec, this lets you specify an exact version number to set the package to. And if the package comes from a git repository, this can be a git revision β€” like a SHA hash or a tag πŸ‘‘ very main character of you.
  • -w, --workspace β€” Attempts to update only packages defined in the workspace. Other packages get updated only if they don't already exist in the lockfile. This one is highkey useful for updating Cargo.lock after you've changed version numbers in Cargo.toml. glow-up after the glow-up ✨
  • --dry-run β€” Displays what would be updated, but doesn't actually write the lockfile. it's the window shopping of dependency management πŸ›οΈ

πŸ¦‹ Display Options πŸ¦‹

  • -v, --verbose β€” Use verbose output. May be specified twice for "very verbose" output, which includes extra output such as dependency warnings and build script output. May also be specified with the term.verbose config value at https://doc.rust-lang.org/cargo/reference/config.html πŸ’¬
  • -q, --quiet β€” Do not print cargo log messages. May also be specified with the term.quiet config value at https://doc.rust-lang.org/cargo/reference/config.html 🀫
  • --color when β€” Controls when colored output is used. Valid values:
    • auto (default): Automatically detect if color support is available on the terminal. 🎨
    • always: Always display colors. 🌈
    • never: Never display colors. πŸ–€

May also be specified with the term.color config value at https://doc.rust-lang.org/cargo/reference/config.html

🧚 Manifest Options 🧚

  • --manifest-path path β€” Path to the Cargo.toml file. By default, Cargo searches for the Cargo.toml file in the current directory or any parent directory. it will climb the whole family tree to find it πŸ”
  • --frozen, --locked β€” Either of these flags requires that the Cargo.lock file is up-to-date. If the lock file is missing, or it needs to be updated, Cargo will exit with an error 😭 The --frozen flag also prevents Cargo from attempting to access the network to determine if it's out-of-date. βœ‹πŸŒ

These may be used in environments where you want to assert that the Cargo.lock file is up-to-date (such as a CI build) or where you want to avoid network access. very "trust me bro, the lockfile is correct" energy, but enforced πŸ’€

  • --offline β€” Prevents Cargo from accessing the network for any reason. Without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. With this flag, Cargo will attempt to proceed without the network if possible. airplane mode but make it build πŸ›¬
Beware that this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. See the cargo-fetch(1) command to download dependencies before going offline. 🫣

May also be specified with the net.offline config value at https://doc.rust-lang.org/cargo/reference/config.html

⭐ Common Options ⭐

  • +toolchain β€” If Cargo has been installed with rustup, and the first argument to cargo begins with +, it will be interpreted as a rustup toolchain name (such as +stable or +nightly). See the rustup documentation at https://rust-lang.github.io/rustup/overrides.html for more information about how toolchain overrides work. πŸ’«
  • --config KEY=VALUE or PATH β€” Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE, or provided as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides section at https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides for more information. πŸ“
  • -C PATH β€” Changes the current working directory before executing any specified operations. This affects things like where cargo looks by default for the project manifest (Cargo.toml), as well as the directories searched for discovering .cargo/config.toml, for example. This option must appear before the command name, for example cargo -C path/to/my-project build. πŸ“
This option is only available on the nightly channel at https://doc.rust-lang.org/book/appendix-07-nightly-rust.html and requires the -Z unstable-options flag to enable (see #10098 at https://github.com/rust-lang/cargo/issues/10098). πŸ‘€
  • -h, --help β€” Prints help information. πŸ†˜
  • -Z flag β€” Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details. πŸ§ͺ

🌱 ENVIRONMENT 🌱

See the reference at https://doc.rust-lang.org/cargo/reference/environment-variables.html for details on environment variables that Cargo reads. 🌍


πŸ”₯ EXIT STATUS πŸ”₯

  • 0: Cargo succeeded. πŸŽ‰ ate. left no crumbs.
  • 101: Cargo failed to complete. 😭 it's giving flop era, try again bestie.

🌟 EXAMPLES 🌟

  1. Update all dependencies in the lockfile:
cargo update
  1. Update only specific dependencies:
cargo update foo bar
  1. Set a specific dependency to a specific version:
cargo update foo --precise 1.2.3

πŸ‘‘ SEE ALSO πŸ‘‘

cargo(1), cargo-generate-lockfile(1) 🫢


and that's the whole page, bestie πŸ’– this was the CARGO-UPDATE(1) page from the General Commands Manual β€” no version number or date on this one, just the vibe and the name, iykyk. now go forth and update your dependencies responsibly. slay, stay locked, and don't forget your Cargo.lock βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from