CARGO-VENDOR(1)
π cargo-vendor β vendoring ur deps, but make it local π
okay so bestie, this one's a cargo subcommand (from the General Commands Manual, no less π) and it's genuinely iconic for anyone who's ever needed their dependencies to just exist on disk without a network moment. let's get into it β¨
β¨ SYNOPSIS β¨
cargo vendor [options] [path]
πΈ DESCRIPTION πΈ
so like, this cargo subcommand will vendor all your crates.io and git dependencies for a project into the directory you point at with <path>. once it's done doing its thing, that vendor directory is gonna contain all the remote sources from the dependencies you specified. no cap. π«Ά
and if you've got extra manifests beyond the default one? you can bring those along too with the -s option. multitasking queen energy fr fr π
here's the part that gets people every time: the configuration you need in order to actually use those vendored sources gets printed to stdout aftercargo vendorfinishes vendoring. so you gotta add it or redirect it into your Cargo configuration file β which is usually.cargo/config.toml, locally, for the current package. don't skip this step bestie, it's the whole point π
π OPTIONS π
π¦ Vendor Options π¦
-smanifest,--syncmanifest β specify an extraCargo.tomlmanifest to workspaces that should also be vendored and synced to the output. you can use this one multiple times, go off π--no-deleteβ don't delete the"vendor"directory when vendoring. instead, keep all the existing contents of the vendor directory. hoarder mode: enabled π--respect-source-configβ instead of ignoring[source]configuration by default in.cargo/config.toml, it reads it and uses it when downloading crates from crates.io, for example. respectful king π--versioned-dirsβ normally versions are only added to disambiguate multiple versions of the same package. this option causes all directories in the"vendor"directory to be versioned, which makes it easier to track the history of vendored packages over time, and can help with the performance of re-vendoring when only a subset of the packages have changed. it's giving organized πΈ
π¦ Manifest Options π¦
--manifest-pathpath β path to theCargo.tomlfile. by default, Cargo searches for theCargo.tomlfile in the current directory or any parent directory. it'll go looking for you π--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 is 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 want to avoid network access. very "trust but verify" of you π
--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.
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>.
π 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 <https://doc.rust-lang.org/cargo/reference/config.html>. talkative era π£οΈ-q,--quietβ do not print cargo log messages. may also be specified with theterm.quietconfig value <https://doc.rust-lang.org/cargo/reference/config.html>. silent but deadly β¨--colorwhen β control 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 <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 <https://rust-lang.github.io/rustup/overrides.html> for more information about how toolchain overrides work. main character toolchain selection fr fr π--configKEY=VALUE or PATH β 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 <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 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and requires the -Z unstable-options flag to enable (see #10098 <https://github.com/rust-lang/cargo/issues/10098>). nightly girlies only π§
-h,--helpβ prints help information. we love a helpful icon π-Zflag β unstable (nightly-only) flags to Cargo. runcargo -Z helpfor details. living on the edge π₯
π± ENVIRONMENT π±
see the reference <https://doc.rust-lang.org/cargo/reference/environment-variables.html> for details on environment variables that Cargo reads. it's all in there, iykyk π
π EXIT STATUS π
0: Cargo succeeded. slay β101: Cargo failed to complete. not slay π
β EXAMPLES β
- vendor all dependencies into a local
"vendor"folder
cargo vendor
- vendor all dependencies into a local
"third-party/vendor"folder
cargo vendor third-party/vendor
- vendor the current workspace as well as another to
"vendor"
cargo vendor -s ../path/to/Cargo.toml
- vendor and redirect the necessary vendor configs to a config file.
cargo vendor > path/to/my/cargo/config.toml
π«Ά SEE ALSO π«Ά
okay that's the whole page bestie, you're officially a vendoring expert π this was cargo-vendor(1) from the General Commands Manual β go forth and vendor responsibly, periodt β¨ππ¦
π¦ 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