Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

Cargo

doc.rust-lang.org

  • Free plan
  • Windows
  • macOS
  • Linux
8.2 Club score Visit doc.rust-lang.org

What Cargo is

Cargo is the free Rust package manager and build tool, used from the command line. It downloads dependencies, builds packages, and helps keep builds repeatable with lockfiles. Developers can compile, check, document, test, run, package, install, and publish Rust projects with it. The `cargo new` command creates a binary package by default; adding `--lib` creates a library. Cargo uses crates.io by default and also supports alternate registries, Git dependencies, and local filesystem paths. Workspaces let multiple packages share a lockfile and output directory, while package features can enable conditional compilation and optional dependencies. Offline mode avoids network access and tries to use locally cached data. Cargo also supports extensible subcommands and registry authentication, including credential providers that can store tokens in platform credential stores; its `cargo:token` provider stores tokens as unencrypted text. Rustup installs Cargo alongside the stable Rust release, with instructions for Windows, macOS, Linux, and other Unix-like systems. Some documented features remain unstable and require a nightly toolchain and `-Z` flags.

Who it suits

Cargo suits developers building and managing Rust packages, from individual projects to workspaces with multiple packages. It is also relevant to teams that need lockfiles, alternate dependency sources, or offline builds.

Good to know, and what to watch

  • Downloads and builds dependencies
  • Lockfiles help make builds repeatable
  • Supports crates.io, alternate registries, Git, and local paths
  • Offline mode can use locally cached data
  • Available through Rustup on several operating systems
  • Some features require a nightly toolchain and `-Z` flags
  • The `cargo:token` provider stores tokens as unencrypted text

Cargo

Free

Free plan

Getting started

  1. Install the stable Rust release with rustup on Windows, macOS, or Linux
  2. Open a command-line interface
  3. Run cargo new to create a binary package, or use --lib for a library
  4. Add dependencies from crates.io, another registry, Git, or a local path
  5. Use Cargo commands to build, test, package, install, or publish

Limits to check

Cargo is free. Offline mode can proceed only with locally cached data, and some documented features require a nightly toolchain with -Z flags.

The Club's review

Cargo is the command-line package manager and build system that Rust developers use to carry a project from dependency resolution through publishing. It is the best fit for teams standardising Rust builds, especially when reproducibility and multi-package workspaces matter. Its free, integrated workflow is compelling, but registry security choices and occasional nightly-only capabilities deserve attention.

Overview

Cargo manages the full Rust package lifecycle. It downloads dependencies, invokes rustc or another build tool with appropriate parameters, and provides commands for compiling, checking, documenting, testing, running, packaging, installing and publishing packages. cargo new creates a binary package by default; adding --lib starts a library package.

Dependencies may come from crates.io, alternate registries, Git repositories or local filesystem paths. Cargo resolves versions and records them in a lockfile, helping continuous-integration and release builds use the same inputs. The trade-off is focus: this is a Rust package tool, not a general dependency manager for mixed-language projects.

Key features

Registries and dependency control

Crates.io is the default source, while alternate registries can be configured in .cargo/config.toml through Git or sparse protocols. Private registry authentication is supported. Credential providers can place tokens in Windows Credential Manager, macOS Keychain or libsecret; the cargo:token provider stores tokens as unencrypted text, so administrators should select a provider that matches their security policy.

Git and local-path dependencies are useful for unreleased code and monorepos, while package features enable conditional compilation and optional dependencies through flags such as --features. Cargo can mark a published version yanked so new resolution avoids it without breaking projects whose lockfiles already select that version.

Builds, workspaces and offline use

A workspace groups one or more packages under shared dependency state and a common output directory. That arrangement reduces duplication for related crates, though it also means workspace structure should be planned before a repository grows large. Setting net.offline to true or passing --offline prevents network access and attempts to use cached data; this is valuable for restricted environments, but succeeds only when required packages are already available locally.

Automation and extension

Cargo's command-line design suits scripted development and CI. Its guide includes build and test examples for GitHub Actions, GitLab CI, builds.sr.ht and CircleCI. New subcommands can extend Cargo without changing the core tool, allowing teams to add project-specific operations. Some documented capabilities are unstable, require a nightly toolchain and use -Z flags; production workflows should verify stability before depending on them.

Pricing

Cargo — free (Free Rust package manager and build tool). There is no paid tier, trial period or renewal charge. The free plan includes dependency management, builds, package creation, publishing and the registry and workspace features described above. Because Cargo is distributed with the Rust toolchain, cost is not the deciding factor; Rust compatibility and your operational requirements are.

Platforms

Cargo is included with the stable Rust toolchain installed through rustup. Installation instructions cover Windows, macOS, Linux and other Unix-like systems, matching Cargo's documented support for Linux, macOS and Windows. It handles Rust crates and packages from crates.io, alternate registries, Git sources and local paths.

Who it's for

Cargo is the natural choice for Rust application and library developers who want one CLI for dependencies, compilation, tests, documentation and release publishing. It also suits teams maintaining several related crates, where shared lockfiles and output directories simplify coordination, and CI operators who need repeatable builds or offline execution.

Look elsewhere if your project is primarily written in another language, if a graphical workflow is essential, or if your organisation cannot accept nightly-only requirements for selected capabilities. Teams using private registries should also review token storage before standardising on a credential provider.

Pros and cons

Pros

  • Complete Rust lifecycle: dependency resolution, builds, tests, documentation, packaging, installation and publishing share one command-line workflow.
  • Reproducible dependency state: lockfiles and workspace support help keep multi-package and CI builds aligned.
  • Broad dependency sources: crates.io, alternate registries, Git and local paths cover public, private and in-development code.
  • Useful restricted-network mode: offline operation can proceed from locally cached packages.
  • Open-source and free: Cargo is primarily under the MIT and Apache 2.0 licenses, with no paid plan or usage charge.

Cons

  • Rust-only scope: it does not replace a cross-language package manager.
  • Credential-provider risk varies: the token provider keeps credentials unencrypted, requiring deliberate configuration.
  • Nightly constraints: some features need nightly Rust and -Z flags, which can complicate stable release pipelines.
  • Offline mode is cache-dependent: missing packages cannot be fetched while network access is disabled.

Alternatives

For a wider survey, see Package Managers.

  • npm is a better fit for JavaScript and public-package publishing; its free plan supports unlimited public packages and registry access, with paid plans also offered.
  • uv suits Python teams wanting a free, open-source package tool for that ecosystem.
  • Gradle is preferable when a general build system across JVM and other project types is required.
  • Hex fits teams seeking a hosted registry with public and private package workflows.
  • Yarn is an alternative free package manager for JavaScript projects.
  • pip is the straightforward free choice for Python package installation.
  • Apache Maven fits Java builds that require a conventional, free build tool and JDK 8+.
  • Composer is the free dependency manager for PHP projects.

Verdict

Choose Cargo if you develop Rust and want dependency resolution, reproducible builds, workspace coordination and package publishing in one free CLI. Its main reason to choose something else is a non-Rust codebase—or a need to avoid credential configurations and unstable features that require extra operational care.

The verdict

Cargo brings dependency management, building, and package publishing into one command-line tool. Its stable, everyday workflows are broad, but users should check whether a needed feature is marked unstable and choose registry credential handling deliberately.

Questions people ask

How much does Cargo cost?

Cargo costs nothing. It is distributed as the free Rust package manager and build tool.

Which systems support Cargo?

Installation instructions cover Windows, macOS, Linux, and other Unix-like systems.

Where does Cargo get packages?

crates.io is the default registry. Cargo also supports alternate registries, Git dependencies, and local filesystem paths.

Can Cargo work offline?

Yes. Set net.offline to true or use --offline; Cargo then avoids network access and tries to use cached data.

Is Cargo open source?

Yes. Cargo is primarily distributed under the MIT License and Apache License, Version 2.0.

Does Cargo support workspaces?

Yes. A workspace manages one or more packages together with a shared Cargo.lock file and output directory.

What the maker publishes

Alternate registries
Cargo supports alternate registries configured through .cargo/config.toml and supports git and sparse registry protocols. source
Build tool
Cargo invokes rustc or another build tool with the correct parameters to build packages. source
CI integrations
The Cargo guide gives build and test examples for GitHub Actions, GitLab CI, builds.sr.ht, and CircleCI. source
Command line
Cargo is used through a command line interface. source
Commands
Cargo includes commands for compiling, checking, documenting, testing, running, packaging, installing, and publishing Rust packages. source
Conditional compilation
Cargo features express conditional compilation and optional dependencies and are enabled with command-line flags such as --features. source
Conditional features
Package features allow conditional compilation and optional dependencies, and can be enabled from the command line. source
Default registry
Cargo installs crates and fetches dependencies from a registry, with crates.io as the default registry. source
Dependencies
Cargo supports dependencies from crates.io, other registries, Git repositories, and local filesystem paths. source
Dependency management
Cargo downloads and builds package dependencies and helps ensure repeatable builds. source
Dependency resolution
Yes source
Extensibility
Cargo supports new subcommands without modifying Cargo itself. source
Free plan
Yes source
Installation
The documented rustup installer installs Cargo alongside the stable Rust release. source
Intended users
The Cargo Book presents Cargo as a tool for developing Rust packages. source
Lockfile support
Yes source
Nightly constraints
Cargo documents some features as unstable and requiring a nightly toolchain and -Z flags. source
Offline installation
Yes source
Offline operation
With net.offline set to true or the --offline option, Cargo avoids accessing the network and attempts to proceed with locally cached data. source
Package creation
The cargo new command creates a package and defaults to creating a binary program; --lib creates a library. source
Package formats
Rust crates; crates.io packages; alternate registry packages; Git dependencies; local path dependencies source
Package yanking
Cargo can mark a published crate version yanked so new dependency resolution avoids it while existing lockfiles continue to work. source
Private registry auth
Yes source
Purpose
Cargo is the Rust package manager. source

Checked against the maker's pages on 30 Sept 2026.