1CARGO-UPDATE(1) General Commands Manual CARGO-UPDATE(1)
2
3
4
6 cargo-update - Update dependencies as recorded in the local lock file
7
9 cargo update [options]
10
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
17 Update Options
18 -p spec..., --package 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 the -p flag, then a conservative
23 update of the lockfile will be performed. This means that only the
24 dependency specified by SPEC will be updated. Its transitive
25 dependencies will be updated only if SPEC cannot be updated without
26 updating dependencies. All other dependencies will remain locked at
27 their currently recorded versions.
28
29 If -p is not specified, all dependencies are updated.
30
31 --aggressive
32 When used with -p, dependencies of spec are forced to update as
33 well. Cannot be used with --precise.
34
35 --precise precise
36 When used with -p, allows you to specify a specific version number
37 to set the package to. If the package comes from a git repository,
38 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
66 • auto (default): Automatically detect if color support is
67 available on the terminal.
68
69 • always: Always display colors.
70
71 • never: 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 -h, --help
124 Prints help information.
125
126 -Z flag
127 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
128 details.
129
131 See the reference
132 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
133 for details on environment variables that Cargo reads.
134
136 • 0: Cargo succeeded.
137
138 • 101: Cargo failed to complete.
139
141 1. Update all dependencies in the lockfile:
142
143 cargo update
144
145 2. Update only specific dependencies:
146
147 cargo update -p foo -p bar
148
149 3. Set a specific dependency to a specific version:
150
151 cargo update -p foo --precise 1.2.3
152
154 cargo(1), cargo-generate-lockfile(1)
155
156
157
158 CARGO-UPDATE(1)