1CARGO(1)                                                              CARGO(1)
2
3
4

NAME

6       cargo - The Rust package manager
7

SYNOPSIS

9       cargo [OPTIONS] COMMAND [ARGS]
10       cargo [OPTIONS] --version
11       cargo [OPTIONS] --list
12       cargo [OPTIONS] --help
13       cargo [OPTIONS] --explain CODE
14

DESCRIPTION

16       This program is a package manager and build tool for the Rust language,
17       available at https://rust-lang.org.
18

COMMANDS

20   Build Commands
21       cargo-bench(1)
22           Execute benchmarks of a package.
23
24       cargo-build(1)
25           Compile a package.
26
27       cargo-check(1)
28           Check a local package and all of its dependencies for errors.
29
30       cargo-clean(1)
31           Remove artifacts that Cargo has generated in the past.
32
33       cargo-doc(1)
34           Build a package’s documentation.
35
36       cargo-fetch(1)
37           Fetch dependencies of a package from the network.
38
39       cargo-fix(1)
40           Automatically fix lint warnings reported by rustc.
41
42       cargo-run(1)
43           Run a binary or example of the local package.
44
45       cargo-rustc(1)
46           Compile a package, and pass extra options to the compiler.
47
48       cargo-rustdoc(1)
49           Build a package’s documentation, using specified custom flags.
50
51       cargo-test(1)
52           Execute unit and integration tests of a package.
53
54   Manifest Commands
55       cargo-generate-lockfile(1)
56           Generate Cargo.lock for a project.
57
58       cargo-locate-project(1)
59           Print a JSON representation of a Cargo.toml file’s location.
60
61       cargo-metadata(1)
62           Output the resolved dependencies of a package, the concrete used
63           versions including overrides, in machine-readable format.
64
65       cargo-pkgid(1)
66           Print a fully qualified package specification.
67
68       cargo-update(1)
69           Update dependencies as recorded in the local lock file.
70
71       cargo-vendor(1)
72           Vendor all dependencies locally.
73
74       cargo-verify-project(1)
75           Check correctness of crate manifest.
76
77   Package Commands
78       cargo-init(1)
79           Create a new Cargo package in an existing directory.
80
81       cargo-install(1)
82           Build and install a Rust binary.
83
84       cargo-new(1)
85           Create a new Cargo package.
86
87       cargo-search(1)
88           Search packages in crates.io.
89
90       cargo-uninstall(1)
91           Remove a Rust binary.
92
93   Publishing Commands
94       cargo-login(1)
95           Save an API token from the registry locally.
96
97       cargo-owner(1)
98           Manage the owners of a crate on the registry.
99
100       cargo-package(1)
101           Assemble the local package into a distributable tarball.
102
103       cargo-publish(1)
104           Upload a package to the registry.
105
106       cargo-yank(1)
107           Remove a pushed crate from the index.
108
109   General Commands
110       cargo-help(1)
111           Display help information about Cargo.
112
113       cargo-version(1)
114           Show version information.
115

OPTIONS

117   Special Options
118       -V, --version
119           Print version info and exit. If used with --verbose, prints extra
120           information.
121
122       --list
123           List all installed Cargo subcommands. If used with --verbose,
124           prints extra information.
125
126       --explain CODE
127           Run rustc --explain CODE which will print out a detailed
128           explanation of an error message (for example, E0004).
129
130   Display Options
131       -v, --verbose
132           Use verbose output. May be specified twice for "very verbose"
133           output which includes extra output such as dependency warnings and
134           build script output. May also be specified with the term.verbose
135           config value
136           <https://doc.rust-lang.org/cargo/reference/config.html>.
137
138       -q, --quiet
139           No output printed to stdout.
140
141       --color WHEN
142           Control when colored output is used. Valid values:
143
144           ·   auto (default): Automatically detect if color support is
145               available on the terminal.
146
147           ·   always: Always display colors.
148
149           ·   never: Never display colors.
150
151           May also be specified with the term.color config value
152           <https://doc.rust-lang.org/cargo/reference/config.html>.
153
154   Manifest Options
155       --frozen, --locked
156           Either of these flags requires that the Cargo.lock file is
157           up-to-date. If the lock file is missing, or it needs to be updated,
158           Cargo will exit with an error. The --frozen flag also prevents
159           Cargo from attempting to access the network to determine if it is
160           out-of-date.
161
162           These may be used in environments where you want to assert that the
163           Cargo.lock file is up-to-date (such as a CI build) or want to avoid
164           network access.
165
166       --offline
167           Prevents Cargo from accessing the network for any reason. Without
168           this flag, Cargo will stop with an error if it needs to access the
169           network and the network is not available. With this flag, Cargo
170           will attempt to proceed without the network if possible.
171
172           Beware that this may result in different dependency resolution than
173           online mode. Cargo will restrict itself to crates that are
174           downloaded locally, even if there might be a newer version as
175           indicated in the local copy of the index. See the cargo-fetch(1)
176           command to download dependencies before going offline.
177
178           May also be specified with the net.offline config value
179           <https://doc.rust-lang.org/cargo/reference/config.html>.
180
181   Common Options
182       -h, --help
183           Prints help information.
184
185       -Z FLAG...
186           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
187           details.
188

ENVIRONMENT

190       See the reference
191       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
192       for details on environment variables that Cargo reads.
193

EXIT STATUS

195       0
196           Cargo succeeded.
197
198       101
199           Cargo failed to complete.
200

FILES

202       ~/.cargo/
203           Default location for Cargo’s "home" directory where it stores
204           various files. The location can be changed with the CARGO_HOME
205           environment variable.
206
207       $CARGO_HOME/bin/
208           Binaries installed by cargo-install(1) will be located here. If
209           using rustup, executables distributed with Rust are also located
210           here.
211
212       $CARGO_HOME/config
213           The global configuration file. See the reference
214           <https://doc.rust-lang.org/cargo/reference/config.html> for more
215           information about configuration files.
216
217       .cargo/config
218           Cargo automatically searches for a file named .cargo/config in the
219           current directory, and all parent directories. These configuration
220           files will be merged with the global configuration file.
221
222       $CARGO_HOME/credentials
223           Private authentication information for logging in to a registry.
224
225       $CARGO_HOME/registry/
226           This directory contains cached downloads of the registry index and
227           any downloaded dependencies.
228
229       $CARGO_HOME/git/
230           This directory contains cached downloads of git dependencies.
231
232       Please note that the internal structure of the $CARGO_HOME directory is
233       not stable yet and may be subject to change.
234

EXAMPLES

236        1. Build a local package and all of its dependencies:
237
238               cargo build
239
240        2. Build a package with optimizations:
241
242               cargo build --release
243
244        3. Run tests for a cross-compiled target:
245
246               cargo test --target i686-unknown-linux-gnu
247
248        4. Create a new package that builds an executable:
249
250               cargo new foobar
251
252        5. Create a package in the current directory:
253
254               mkdir foo && cd foo
255               cargo init .
256
257        6. Learn about a command’s options and usage:
258
259               cargo help clean
260

BUGS

262       See https://github.com/rust-lang/cargo/issues for issues.
263

SEE ALSO

265       rustc(1), rustdoc(1)
266
267
268
269                                  2019-12-04                          CARGO(1)
Impressum