1CARGO-FETCH(1)              General Commands Manual             CARGO-FETCH(1)
2
3
4

NAME

6       cargo-fetch - Fetch dependencies of a package from the network
7

SYNOPSIS

9       cargo fetch [options]
10

DESCRIPTION

12       If a Cargo.lock file is available, this command will ensure that all of
13       the git dependencies and/or registry dependencies are downloaded and
14       locally available. Subsequent Cargo commands will be able to run
15       offline after a cargo fetch unless the lock file changes.
16
17       If the lock file is not available, then this command will generate the
18       lock file before fetching the dependencies.
19
20       If --target is not specified, then all target dependencies are fetched.
21
22       See also the cargo-prefetch <https://crates.io/crates/cargo-prefetch>
23       plugin which adds a command to download popular crates. This may be
24       useful if you plan to use Cargo without a network with the --offline
25       flag.
26

OPTIONS

28   Fetch options
29       --target triple
30           Fetch for the given architecture. The default is all architectures.
31           The general format of the triple is
32           <arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
33           a list of supported targets. This flag may be specified multiple
34           times.
35
36           This may also be specified with the build.target config value
37           <https://doc.rust-lang.org/cargo/reference/config.html>.
38
39           Note that specifying this flag makes Cargo run in a different mode
40           where the target artifacts are placed in a separate directory. See
41           the build cache
42           <https://doc.rust-lang.org/cargo/guide/build-cache.html>
43           documentation for more details.
44
45   Display Options
46       -v, --verbose
47           Use verbose output. May be specified twice for "very verbose"
48           output which includes extra output such as dependency warnings and
49           build script output. May also be specified with the term.verbose
50           config value
51           <https://doc.rust-lang.org/cargo/reference/config.html>.
52
53       -q, --quiet
54           Do not print cargo log messages. May also be specified with the
55           term.quiet config value
56           <https://doc.rust-lang.org/cargo/reference/config.html>.
57
58       --color when
59           Control when colored output is used. Valid values:
60
61auto (default): Automatically detect if color support is
62               available on the terminal.
63
64always: Always display colors.
65
66never: Never display colors.
67
68           May also be specified with the term.color config value
69           <https://doc.rust-lang.org/cargo/reference/config.html>.
70
71   Manifest Options
72       --manifest-path path
73           Path to the Cargo.toml file. By default, Cargo searches for the
74           Cargo.toml file in the current directory or any parent directory.
75
76       --frozen, --locked
77           Either of these flags requires that the Cargo.lock file is
78           up-to-date. If the lock file is missing, or it needs to be updated,
79           Cargo will exit with an error. The --frozen flag also prevents
80           Cargo from attempting to access the network to determine if it is
81           out-of-date.
82
83           These may be used in environments where you want to assert that the
84           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
85           network access.
86
87       --offline
88           Prevents Cargo from accessing the network for any reason. Without
89           this flag, Cargo will stop with an error if it needs to access the
90           network and the network is not available. With this flag, Cargo
91           will attempt to proceed without the network if possible.
92
93           Beware that this may result in different dependency resolution than
94           online mode. Cargo will restrict itself to crates that are
95           downloaded locally, even if there might be a newer version as
96           indicated in the local copy of the index. See the cargo-fetch(1)
97           command to download dependencies before going offline.
98
99           May also be specified with the net.offline config value
100           <https://doc.rust-lang.org/cargo/reference/config.html>.
101
102   Common Options
103       +toolchain
104           If Cargo has been installed with rustup, and the first argument to
105           cargo begins with +, it will be interpreted as a rustup toolchain
106           name (such as +stable or +nightly). See the rustup documentation
107           <https://rust-lang.github.io/rustup/overrides.html> for more
108           information about how toolchain overrides work.
109
110       --config KEY=VALUE or PATH
111           Overrides a Cargo configuration value. The argument should be in
112           TOML syntax of KEY=VALUE, or provided as a path to an extra
113           configuration file. This flag may be specified multiple times. See
114           the command-line overrides section
115           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
116           for more information.
117
118       -h, --help
119           Prints help information.
120
121       -Z flag
122           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
123           details.
124

ENVIRONMENT

126       See the reference
127       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
128       for details on environment variables that Cargo reads.
129

EXIT STATUS

1310: Cargo succeeded.
132
133101: Cargo failed to complete.
134

EXAMPLES

136        1. Fetch all dependencies:
137
138               cargo fetch
139

SEE ALSO

141       cargo(1), cargo-update(1), cargo-generate-lockfile(1)
142
143
144
145                                                                CARGO-FETCH(1)
Impressum