1CARGO-REMOVE(1) General Commands Manual CARGO-REMOVE(1)
2
3
4
6 cargo-remove — Remove dependencies from a Cargo.toml manifest file
7
9 cargo remove [options] dependency…
10
12 Remove one or more dependencies from a Cargo.toml manifest.
13
15 Section options
16 --dev
17 Remove as a development dependency
18 <https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#development-dependencies>.
19
20 --build
21 Remove as a build dependency
22 <https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#build-dependencies>.
23
24 --target target
25 Remove as a dependency to the given target platform
26 <https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies>.
27
28 To avoid unexpected shell expansions, you may use quotes around
29 each target, e.g., --target 'cfg(unix)'.
30
31 Miscellaneous Options
32 --dry-run
33 Don’t actually write to the manifest.
34
35 Display Options
36 -v, --verbose
37 Use verbose output. May be specified twice for “very verbose”
38 output which includes extra output such as dependency warnings and
39 build script output. May also be specified with the term.verbose
40 config value
41 <https://doc.rust-lang.org/cargo/reference/config.html>.
42
43 -q, --quiet
44 Do not print cargo log messages. May also be specified with the
45 term.quiet config value
46 <https://doc.rust-lang.org/cargo/reference/config.html>.
47
48 --color when
49 Control when colored output is used. Valid values:
50
51 • auto (default): Automatically detect if color support is
52 available on the terminal.
53
54 • always: Always display colors.
55
56 • never: Never display colors.
57
58 May also be specified with the term.color config value
59 <https://doc.rust-lang.org/cargo/reference/config.html>.
60
61 Manifest Options
62 --manifest-path path
63 Path to the Cargo.toml file. By default, Cargo searches for the
64 Cargo.toml file in the current directory or any parent directory.
65
66 --frozen, --locked
67 Either of these flags requires that the Cargo.lock file is
68 up-to-date. If the lock file is missing, or it needs to be updated,
69 Cargo will exit with an error. The --frozen flag also prevents
70 Cargo from attempting to access the network to determine if it is
71 out-of-date.
72
73 These may be used in environments where you want to assert that the
74 Cargo.lock file is up-to-date (such as a CI build) or want to avoid
75 network access.
76
77 --offline
78 Prevents Cargo from accessing the network for any reason. Without
79 this flag, Cargo will stop with an error if it needs to access the
80 network and the network is not available. With this flag, Cargo
81 will attempt to proceed without the network if possible.
82
83 Beware that this may result in different dependency resolution than
84 online mode. Cargo will restrict itself to crates that are
85 downloaded locally, even if there might be a newer version as
86 indicated in the local copy of the index. See the cargo-fetch(1)
87 command to download dependencies before going offline.
88
89 May also be specified with the net.offline config value
90 <https://doc.rust-lang.org/cargo/reference/config.html>.
91
92 Package Selection
93 -p spec…, --package spec…
94 Package to remove from.
95
96 Common Options
97 +toolchain
98 If Cargo has been installed with rustup, and the first argument to
99 cargo begins with +, it will be interpreted as a rustup toolchain
100 name (such as +stable or +nightly). See the rustup documentation
101 <https://rust-lang.github.io/rustup/overrides.html> for more
102 information about how toolchain overrides work.
103
104 --config KEY=VALUE or PATH
105 Overrides a Cargo configuration value. The argument should be in
106 TOML syntax of KEY=VALUE, or provided as a path to an extra
107 configuration file. This flag may be specified multiple times. See
108 the command-line overrides section
109 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
110 for more information.
111
112 -C PATH
113 Changes the current working directory before executing any
114 specified operations. This affects things like where cargo looks by
115 default for the project manifest (Cargo.toml), as well as the
116 directories searched for discovering .cargo/config.toml, for
117 example. This option must appear before the command name, for
118 example cargo -C path/to/my-project build.
119
120 This option is only available on the nightly channel
121 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
122 requires the -Z unstable-options flag to enable (see #10098
123 <https://github.com/rust-lang/cargo/issues/10098>).
124
125 -h, --help
126 Prints help information.
127
128 -Z flag
129 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
130 details.
131
133 See the reference
134 <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
135 for details on environment variables that Cargo reads.
136
138 • 0: Cargo succeeded.
139
140 • 101: Cargo failed to complete.
141
143 1. Remove regex as a dependency
144
145 cargo remove regex
146
147 2. Remove trybuild as a dev-dependency
148
149 cargo remove --dev trybuild
150
151 3. Remove nom from the x86_64-pc-windows-gnu dependencies table
152
153 cargo remove --target x86_64-pc-windows-gnu nom
154
156 cargo(1), cargo-add(1)
157
158
159
160 CARGO-REMOVE(1)