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

NAME

6       cargo-update — Update dependencies as recorded in the local lock file
7

SYNOPSIS

9       cargo update [options] spec
10

DESCRIPTION

12       This command will update dependencies in the Cargo.lock file to the
13       latest version. If the Cargo.lock file does not exist, it will be
14       created with the latest available versions.
15

OPTIONS

17   Update Options
18       spec
19           Update only the specified packages. This flag may be specified
20           multiple times. See cargo-pkgid(1) for the SPEC format.
21
22           If packages are specified with spec, then a conservative update of
23           the lockfile will be performed. This means that only the dependency
24           specified by SPEC will be updated. Its transitive dependencies will
25           be updated only if SPEC cannot be updated without updating
26           dependencies. All other dependencies will remain locked at their
27           currently recorded versions.
28
29           If spec is not specified, all dependencies are updated.
30
31       --recursive
32           When used with spec, dependencies of spec are forced to update as
33           well. Cannot be used with --precise.
34
35       --precise precise
36           When used with spec, allows you to specify a specific version
37           number to set the package to. If the package comes from a git
38           repository, this can be a git revision (such as a SHA hash or tag).
39
40       -w, --workspace
41           Attempt to update only packages defined in the workspace. Other
42           packages are updated only if they don’t already exist in the
43           lockfile. This option is useful for updating Cargo.lock after
44           you’ve changed version numbers in Cargo.toml.
45
46       --dry-run
47           Displays what would be updated, but doesn’t actually write the
48           lockfile.
49
50   Display Options
51       -v, --verbose
52           Use verbose output. May be specified twice for “very verbose”
53           output which includes extra output such as dependency warnings and
54           build script output. May also be specified with the term.verbose
55           config value
56           <https://doc.rust-lang.org/cargo/reference/config.html>.
57
58       -q, --quiet
59           Do not print cargo log messages. May also be specified with the
60           term.quiet config value
61           <https://doc.rust-lang.org/cargo/reference/config.html>.
62
63       --color when
64           Control when colored output is used. Valid values:
65
66auto (default): Automatically detect if color support is
67               available on the terminal.
68
69always: Always display colors.
70
71never: Never display colors.
72
73           May also be specified with the term.color config value
74           <https://doc.rust-lang.org/cargo/reference/config.html>.
75
76   Manifest Options
77       --manifest-path path
78           Path to the Cargo.toml file. By default, Cargo searches for the
79           Cargo.toml file in the current directory or any parent directory.
80
81       --frozen, --locked
82           Either of these flags requires that the Cargo.lock file is
83           up-to-date. If the lock file is missing, or it needs to be updated,
84           Cargo will exit with an error. The --frozen flag also prevents
85           Cargo from attempting to access the network to determine if it is
86           out-of-date.
87
88           These may be used in environments where you want to assert that the
89           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
90           network access.
91
92       --offline
93           Prevents Cargo from accessing the network for any reason. Without
94           this flag, Cargo will stop with an error if it needs to access the
95           network and the network is not available. With this flag, Cargo
96           will attempt to proceed without the network if possible.
97
98           Beware that this may result in different dependency resolution than
99           online mode. Cargo will restrict itself to crates that are
100           downloaded locally, even if there might be a newer version as
101           indicated in the local copy of the index. See the cargo-fetch(1)
102           command to download dependencies before going offline.
103
104           May also be specified with the net.offline config value
105           <https://doc.rust-lang.org/cargo/reference/config.html>.
106
107   Common Options
108       +toolchain
109           If Cargo has been installed with rustup, and the first argument to
110           cargo begins with +, it will be interpreted as a rustup toolchain
111           name (such as +stable or +nightly). See the rustup documentation
112           <https://rust-lang.github.io/rustup/overrides.html> for more
113           information about how toolchain overrides work.
114
115       --config KEY=VALUE or PATH
116           Overrides a Cargo configuration value. The argument should be in
117           TOML syntax of KEY=VALUE, or provided as a path to an extra
118           configuration file. This flag may be specified multiple times. See
119           the command-line overrides section
120           <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
121           for more information.
122
123       -C PATH
124           Changes the current working directory before executing any
125           specified operations. This affects things like where cargo looks by
126           default for the project manifest (Cargo.toml), as well as the
127           directories searched for discovering .cargo/config.toml, for
128           example. This option must appear before the command name, for
129           example cargo -C path/to/my-project build.
130
131           This option is only available on the nightly channel
132           <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
133           requires the -Z unstable-options flag to enable (see #10098
134           <https://github.com/rust-lang/cargo/issues/10098>).
135
136       -h, --help
137           Prints help information.
138
139       -Z flag
140           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
141           details.
142

ENVIRONMENT

144       See the reference
145       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
146       for details on environment variables that Cargo reads.
147

EXIT STATUS

1490: Cargo succeeded.
150
151101: Cargo failed to complete.
152

EXAMPLES

154        1. Update all dependencies in the lockfile:
155
156               cargo update
157
158        2. Update only specific dependencies:
159
160               cargo update foo bar
161
162        3. Set a specific dependency to a specific version:
163
164               cargo update foo --precise 1.2.3
165

SEE ALSO

167       cargo(1), cargo-generate-lockfile(1)
168
169
170
171                                                               CARGO-UPDATE(1)
Impressum