cargo man page

cargo — The Rust package manager

TL;DR

cargo search {{search_string}}

cargo install {{crate_name}}

cargo install --list

cargo init --bin

cargo init

cargo build

cargo build -j {{jobs}}

Synopsis

cargo <COMMAND> [<ARGS>...]

Description

This program is a package manager for the Rust language, available at <http://rust-lang.org>.

Options

-h, --help

Display a help message.

-V, --version

Print version information and exit.

--list

List all available cargo commands.

--explain CODE

Run rustc --explain CODE

-v, --verbose

Use verbose output.

--color

Configure coloring of output.

Commands

To get extended information about commands, run cargo help <command> or man cargo-command

cargo-build(1)

Compile the current project.

cargo-clean(1)

Remove the target directory with build output.

cargo-doc(1)

Build this project's and its dependencies' documentation.

cargo-init(1)

Create a new cargo project in the current directory.

cargo-install(1)

Install a Rust binary.

cargo-new(1)

Create a new cargo project.

cargo-run(1)

Build and execute src/main.rs.

cargo-test(1)

Run the tests for the package.

cargo-bench(1)

Run the benchmarks for the package.

cargo-update(1)

Update dependencies in Cargo.lock.

cargo-package(1)

Generate a source tarball for the current package.

cargo-publish(1)

Package and upload this project to the registry.

cargo-owner(1)

Manage the owners of a crate on the registry.

cargo-uninstall(1)

Remove a Rust binary.

cargo-search(1)

Search registry for crates.

cargo-version(1)

Print cargo's version and exit.

Files

~/.cargo

Directory in which Cargo stores repository data. Cargo can be instructed to use a .cargo subdirectory in a different location by setting the CARGO_HOME environment variable.

Examples

Build a local package and all of its dependencies

$ cargo build

Build a package with optimizations

$ cargo build --release

Run tests for a cross-compiled target

$ cargo test --target i686-unknown-linux-gnu

Create a new project that builds an executable

$ cargo new --bin foobar

Create a project in the current directory

$ mkdir foo && cd foo
$ cargo init .

Learn about a command's options and usage

$ cargo help clean

See Also

rustc(1), rustdoc(1)

Bugs

See <https://github.com/rust-lang/cargo/issues> for issues.

Referenced By

cargo-bench(1), cargo-build(1), cargo-check(1), cargo-clean(1), cargo-doc(1), cargo-fetch(1), cargo-generate-lockfile(1), cargo-init(1), cargo-install(1), cargo-login(1), cargo-metadata(1), cargo-new(1), cargo-owner(1), cargo-package(1), cargo-pkgid(1), cargo-publish(1), cargo-run(1), cargo-rustc(1), cargo-rustdoc(1), cargo-search(1), cargo-test(1), cargo-uninstall(1), cargo-update(1), cargo-version(1), cargo-yank(1).

May 2016 The Rust package manager Cargo Manual