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 No output printed to stdout.
60
61 --color when
62 Control when colored output is used. Valid values:
63
64 · auto (default): Automatically detect if color support is
65 available on the terminal.
66
67 · always: Always display colors.
68
69 · never: Never display colors.
70
71 May also be specified with the term.color config value
72 <https://doc.rust-lang.org/cargo/reference/config.html>.
73
74 Manifest Options
75 --manifest-path path
76 Path to the Cargo.toml file. By default, Cargo searches for the
77 Cargo.toml file in the current directory or any parent directory.
78
79 --frozen, --locked
80 Either of these flags requires that the Cargo.lock file is
81 up-to-date. If the lock file is missing, or it needs to be updated,
82 Cargo will exit with an error. The --frozen flag also prevents
83 Cargo from attempting to access the network to determine if it is
84 out-of-date.
85
86 These may be used in environments where you want to assert that the
87 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
88 network access.
89
90 --offline
91 Prevents Cargo from accessing the network for any reason. Without
92 this flag, Cargo will stop with an error if it needs to access the
93 network and the network is not available. With this flag, Cargo
94 will attempt to proceed without the network if possible.
95
96 Beware that this may result in different dependency resolution than
97 online mode. Cargo will restrict itself to crates that are
98 downloaded locally, even if there might be a newer version as
99 indicated in the local copy of the index. See the cargo-fetch(1)
100 command to download dependencies before going offline.
101
102 May also be specified with the net.offline config value
103 <https://doc.rust-lang.org/cargo/reference/config.html>.
104
105 Common Options
106 +toolchain
107 If Cargo has been installed with rustup, and the first argument to
108 cargo begins with +, it will be interpreted as a rustup toolchain
109 name (such as +stable or +nightly). See the rustup documentation
110 <https://rust-lang.github.io/rustup/overrides.html> for more
111 information about how toolchain overrides work.
112
113 -h, --help
114 Prints help information.
115
116 -Z flag
117 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
118 details.
119
121 See the reference
122 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
123 for details on environment variables that Cargo reads.
124
126 · 0: Cargo succeeded.
127
128 · 101: Cargo failed to complete.
129
131 1. Update all dependencies in the lockfile:
132
133 cargo update
134
135 2. Update only specific dependencies:
136
137 cargo update -p foo -p bar
138
139 3. Set a specific dependency to a specific version:
140
141 cargo update -p foo --precise 1.2.3
142
144 cargo(1), cargo-generate-lockfile(1)
145
146
147
148 CARGO-UPDATE(1)