1CARGO-FETCH(1) General Commands Manual CARGO-FETCH(1)
2
3
4
6 cargo-fetch - Fetch dependencies of a package from the network
7
9 cargo fetch [options]
10
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
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.
34
35 This may also be specified with the build.target config value
36 <https://doc.rust-lang.org/cargo/reference/config.html>.
37
38 Note that specifying this flag makes Cargo run in a different mode
39 where the target artifacts are placed in a separate directory. See
40 the build cache
41 <https://doc.rust-lang.org/cargo/guide/build-cache.html>
42 documentation for more details.
43
44 Display Options
45 -v, --verbose
46 Use verbose output. May be specified twice for "very verbose"
47 output which includes extra output such as dependency warnings and
48 build script output. May also be specified with the term.verbose
49 config value
50 <https://doc.rust-lang.org/cargo/reference/config.html>.
51
52 -q, --quiet
53 Do not print cargo log messages. May also be specified with the
54 term.quiet config value
55 <https://doc.rust-lang.org/cargo/reference/config.html>.
56
57 --color when
58 Control when colored output is used. Valid values:
59
60 • auto (default): Automatically detect if color support is
61 available on the terminal.
62
63 • always: Always display colors.
64
65 • never: Never display colors.
66
67 May also be specified with the term.color config value
68 <https://doc.rust-lang.org/cargo/reference/config.html>.
69
70 Manifest Options
71 --manifest-path path
72 Path to the Cargo.toml file. By default, Cargo searches for the
73 Cargo.toml file in the current directory or any parent directory.
74
75 --frozen, --locked
76 Either of these flags requires that the Cargo.lock file is
77 up-to-date. If the lock file is missing, or it needs to be updated,
78 Cargo will exit with an error. The --frozen flag also prevents
79 Cargo from attempting to access the network to determine if it is
80 out-of-date.
81
82 These may be used in environments where you want to assert that the
83 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
84 network access.
85
86 --offline
87 Prevents Cargo from accessing the network for any reason. Without
88 this flag, Cargo will stop with an error if it needs to access the
89 network and the network is not available. With this flag, Cargo
90 will attempt to proceed without the network if possible.
91
92 Beware that this may result in different dependency resolution than
93 online mode. Cargo will restrict itself to crates that are
94 downloaded locally, even if there might be a newer version as
95 indicated in the local copy of the index. See the cargo-fetch(1)
96 command to download dependencies before going offline.
97
98 May also be specified with the net.offline config value
99 <https://doc.rust-lang.org/cargo/reference/config.html>.
100
101 Common Options
102 +toolchain
103 If Cargo has been installed with rustup, and the first argument to
104 cargo begins with +, it will be interpreted as a rustup toolchain
105 name (such as +stable or +nightly). See the rustup documentation
106 <https://rust-lang.github.io/rustup/overrides.html> for more
107 information about how toolchain overrides work.
108
109 -h, --help
110 Prints help information.
111
112 -Z flag
113 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
114 details.
115
117 See the reference
118 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
119 for details on environment variables that Cargo reads.
120
122 • 0: Cargo succeeded.
123
124 • 101: Cargo failed to complete.
125
127 1. Fetch all dependencies:
128
129 cargo fetch
130
132 cargo(1), cargo-update(1), cargo-generate-lockfile(1)
133
134
135
136 CARGO-FETCH(1)