CARGO-UPDATE(1)
β¨ 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 π«Ά Seecargo-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 withspec, the dependencies ofspecare forced to update as well. Cannot be used with--precise. π« (these two do NOT get along, okay?)--preciseprecise β When used withspec, 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 updatingCargo.lockafter you've changed version numbers inCargo.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 theterm.verboseconfig value at https://doc.rust-lang.org/cargo/reference/config.html π¬-q,--quietβ Do not print cargo log messages. May also be specified with theterm.quietconfig value at https://doc.rust-lang.org/cargo/reference/config.html π€«--colorwhen β 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-pathpath β Path to theCargo.tomlfile. By default, Cargo searches for theCargo.tomlfile 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 theCargo.lockfile is up-to-date. If the lock file is missing, or it needs to be updated, Cargo will exit with an error π The--frozenflag 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 tocargobegins with+, it will be interpreted as a rustup toolchain name (such as+stableor+nightly). See the rustup documentation at https://rust-lang.github.io/rustup/overrides.html for more information about how toolchain overrides work. π«--configKEY=VALUEorPATHβ Overrides a Cargo configuration value. The argument should be in TOML syntax ofKEY=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. π-CPATH β 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 examplecargo -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. π-Zflag β Unstable (nightly-only) flags to Cargo. Runcargo -Z helpfor 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 π
- Update all dependencies in the lockfile:
cargo update
- Update only specific dependencies:
cargo update foo bar
- 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
- ubuntu jammy: cargo-1.76 1.76.0+dfsg0ubuntu1~bpo0-0ubuntu0.22.04.1 Β· Apache-2.0 WITH LLVM exception
- ubuntu noble: cargo-1.76 1.76.0+dfsg0ubuntu1-0ubuntu0.24.04.2 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms