cargo

CLI Interface for Cargo

Subcommands

NameDescription
benchExecute all benchmarks of a local package
build,bCompile a local package and all of its dependencies
check,cCheck a local package and all of its dependencies for errors
cleanRemove artifacts that cargo has generated in the past
configInspect configuration values
doc,dBuild a package's documentation
fetchFetch dependencies of a package from the network
fixAutomatically fix lint warnings reported by rustc
generate-lockfileGenerate the lockfile for a package
git-checkoutThis subcommand has been removed
initCreate a new cargo package in an existing directory
installInstall a Rust binary. Default location is $HOME/.cargo/bin
locate-projectPrint a JSON representation of a Cargo.toml file's location
loginSave an api token from the registry locally. If token is not specified, it will be read from stdin
logoutRemove an API token from the registry locally
metadataOutput the resolved dependencies of a package, the concrete used versions including overrides, in machine-readable format
newCreate a new cargo package at <path>
ownerManage the owners of a crate on the registry
packageAssemble the local package into a distributable tarball
pkgidPrint a fully qualified package specification
publishUpload a package to the registry
read-manifestPrint a JSON representation of a Cargo.toml manifest. Deprecated, use `cargo metadata --no-deps` instead
reportGenerate and display various kinds of reports
run,rRun a binary or example of the local package
rustcCompile a package, and pass extra options to the compiler
rustdocBuild a package's documentation, using specified custom flags
searchSearch packages in crates.io
test,tExecute all unit and integration tests and build examples of a local package
treeDisplay a tree visualization of a dependency graph
uninstallRemove a Rust binary
updateUpdate dependencies as recorded in the local lock file
vendorVendor all dependencies for a project locally
verify-projectCheck correctness of crate manifest
versionShow version information
yankRemove a pushed crate from the index
helpPrint this message or the help of the given subcommand(s)

Options

NameDescription
--explain <command>Run `rustc --explain CODE`
--color <command>Coloring: auto, always, never
--config <command>
  • Repeatable ♾
-Z <command>
  • Repeatable ♾
-h,--helpPrint help information
-V,--versionPrint version info and exit
--listList installed commands
-v,--verbose
  • Repeatable ♾
-q,--quietDo not print cargo log messages
--frozenRequire Cargo.lock and cache are up to date
--lockedRequire Cargo.lock is up to date
--offlineRun without accessing the network