LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cargo-vendor

Vendor all dependencies locally

TLDR

Vendor dependencies
$ cargo vendor
copy
Vendor to specific directory
$ cargo vendor [vendor/]
copy
Vendor and save config
$ cargo vendor > .cargo/config.toml
copy
Vendor with versioned directories
$ cargo vendor --versioned-dirs
copy
Vendor specific package
$ cargo vendor -s [package/Cargo.toml]
copy

SYNOPSIS

cargo vendor [options] [path]

DESCRIPTION

cargo vendor downloads and copies all crates.io and git dependencies into a local directory (default: `vendor/`). It outputs the Cargo configuration needed to redirect dependency resolution to the vendored sources.This is primarily used for offline builds, air-gapped environments, and reproducible build systems where network access during compilation is not available or not desired. The vendored sources are read-only; to modify a vendored crate, use the `[patch]` section in Cargo.toml instead of editing files directly in the vendor directory.

PARAMETERS

-s, --sync path

Additional Cargo.toml to sync
--no-delete
Don't delete existing vendor directory
--versioned-dirs
Use versioned directory names
--respect-source-config
Respect [source] config when vendoring
--manifest-path path
Path to Cargo.toml
-v, --verbose
Verbose output
-q, --quiet
Suppress output

CONFIGURATION

.cargo/config.toml

Source replacement settings that redirect dependency resolution to the vendored directory. The output of `cargo vendor` provides the exact configuration to add.

OFFLINE BUILDS

After vendoring:

$ cargo build --offline
copy

CAVEATS

Vendored sources are read-only. Use [patch] for modifications. Resolution may differ from online mode. Run cargo fetch first for complete dependency download.

SEE ALSO

Copied to clipboard
Kai