CARGO-GENERATE-LOCKFILE(1)
๐ NAME ๐
cargo-generate-lockfile โ bestie, this one generates the lockfile for a package. That's it. That's the job. ๐
โจ SYNOPSIS โจ
cargo generate-lockfile [options]
๐ฆ DESCRIPTION ๐ฆ
okay so picture this: you run this command and it creates the Cargo.lock lockfile for whatever package or workspace you're standing in. ๐
And if the lockfile is already there? Not me being lazy โ it gets rebuilt with the latest available version of every package. Glow up, lockfile edition. โจ
Also also also โ go look at cargo-update(1). That one can make a Cargo.lock lockfile too, and it's got more options for controlling update behavior. So if you need finer control, that's your girl. ๐
๐ OPTIONS ๐
๐ Display Options ๐
-v,--verboseโ verbose output, periodt. Say it twice and you get "very verbose" output, which is giving extra stuff like dependency warnings and build script output. You can also set this with theterm.verboseconfig value:https://doc.rust-lang.org/cargo/reference/config.html.-q,--quietโ do not print cargo log messages. silence, iconic, no notes. ๐ซถ Can also be set with theterm.quietconfig value:https://doc.rust-lang.org/cargo/reference/config.html.--color whenโ controls when colored output gets used. Valid values, bestie:auto(default): automatically detect if color support is available on the terminal. lowkey smart of it.always: always display colors. ๐ slay.never: never display colors.
Can also be set with the term.color config value: https://doc.rust-lang.org/cargo/reference/config.html.
๐ธ Manifest Options ๐ธ
--manifest-path pathโ the path to theCargo.tomlfile. By default, Cargo goes hunting forCargo.tomlin the current directory or any parent directory. it's giving detective energy. ๐--ignore-rust-versionโ ignore therust-versionspecification in packages. pretend you didn't see it. ๐--publish-time yyyy-mm-ddThh:mm:ssZโ latest publish time allowed for registry packages (Unstable). โ ๏ธ
This is a best-effort filter on allowed packages, including:
- packages from unsupported registries are always accepted
- only the current yank state is respected, not the state as of
--publish-time - precision of the publish time
--lockedโ asserts that the exact same dependencies and versions are used as when the existingCargo.lockfile was originally generated. Cargo will exit with an error when either of these scenarios arises: ๐- The lock file is missing.
- Cargo attempted to change the lock file due to a different dependency resolution.
It may be used in environments where deterministic builds are desired, such as in CI pipelines. main character CI behavior fr fr.
--offlineโ prevents Cargo from accessing the network for any reason. Without this flag, Cargo stops with an error if it needs the network and the network isn't there. With this flag, Cargo will attempt to proceed without the network if possible. ๐ง
Beware bestie โ 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: https://doc.rust-lang.org/cargo/reference/config.html.
--frozenโ equivalent to specifying both--lockedand--offlineat the same time. two-for-one, we love a bundle. ๐
๐ Common Options ๐
+toolchainโ if Cargo has been installed with rustup, and the first argument to cargo begins with+, it gets interpreted as a rustup toolchain name (like+stableor+nightly). See the rustup documentation for more info on how toolchain overrides work:https://rust-lang.github.io/rustup/overrides.html.--config KEY=VALUE or PATHโ overrides a Cargo configuration value. The argument should be in TOML syntax ofKEY=VALUE, or given as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides section for more:https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides.-C PATHโ changes the current working directory before executing any specified operations. This affects stuff like where cargo looks by default for the project manifest (Cargo.toml), and also the directories searched for discovering.cargo/config.toml, for example. This option must appear before the command name, likecargo -C path/to/my-project build.
This option is only available on the nightly channel and requires the-Z unstable-optionsflag to enable (see #10098:https://github.com/rust-lang/cargo/issues/10098). ๐งโจ
-h,--helpโ prints help information. our hero. ๐ซถ-Z flagโ unstable (nightly-only) flags to Cargo. Runcargo -Z helpfor details. iykyk. ๐
๐ฑ ENVIRONMENT ๐ฑ
See the reference for the details on environment variables that Cargo reads: https://doc.rust-lang.org/cargo/reference/environment-variables.html
โญ EXIT STATUS โญ
0: Cargo succeeded. ๐101: Cargo failed to complete. ๐
๐ EXAMPLES ๐
- Create or update the lockfile for the current package or workspace:
cargo generate-lockfile
๐ SEE ALSO ๐
and that's the whole page bestie, no cap ๐ this was CARGO-GENERATE-LOCKFILE(1) from the General Commands Manual, signing off โ go forth and lock those files, you absolute icon ๐โจ๐ฆ
๐ฆ where this page comes from
- alpine 3.24: cargo-doc 1.96.1-r0 ยท Apache-2.0 OR MIT
- alpine 3.24: chromium-cargo-doc 1.97.0-r0 ยท Apache-2.0 OR MIT
- centos-stream 10: cargo 1.99.1-1.el10 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- centos-stream 9: cargo 1.99.1-1.el9 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- debian bookworm: cargo-web 1.96.0+dfsg1-1~deb12u2 ยท MIT OR Apache-2.0
- debian trixie: cargo-web 1.96.0+dfsg1-1~deb13u1+b1 ยท MIT OR Apache-2.0
- fedora 43: cargo 1.98.1-1.fc43
- fedora 43: cargo 1.99.0-1.fc43
- fedora 43: cargo 1.99.1-2.fc43 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.94.1-1.fc44 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.98.1-1.fc44
- fedora 44: cargo 1.99.0-1.fc44
- fedora 44: cargo 1.99.1-2.fc44 ยท (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- nixos 26.05: cargo 1.95.0
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 ยท Apache-2.0 OR MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms