Checking Cargo Version with cargo --version
Learn how to verify that Cargo, the Rust build tool and package manager, is correctly installed by checking its version from the terminal.
You have already confirmed that rustc - the Rust compiler - is working on your machine. Now it is time to check its closest companion: Cargo. Cargo is the tool you will use to create new Rust projects, download libraries, compile code, run tests, and produce final executables. This page explains what Cargo is, why it matters, and exactly how to verify that it is installed correctly using the cargo --version command.
What Cargo Actually Does
When you write a Rust program, rustc turns your code into an executable. That is only half of the story. Real projects contain many source files, external dependencies, build settings, and tests. Managing all of that by hand would be painful. Cargo automates the entire workflow.
Cargo is both a build tool and a package manager:
- As a build tool, it compiles your project, handles dependencies, runs tests, and builds release binaries.
- As a package manager, it downloads libraries from the crates.io registry and stores them locally so your project can use them.
The Rust installer, rustup, normally installs Cargo automatically alongside rustc. But because installations can occasionally go wrong - or because someone might install Rust components individually - it is important to confirm that Cargo is actually present and executable.
Cargo Is Not Optional:
Almost every real Rust project uses Cargo. Even though you can compile simple files with rustc alone, you will quickly need Cargo for anything that involves multiple files, external crates, or reproducible builds. Verifying Cargo now saves you confusion later.
The Simplest Verification Command
Open your terminal and type:
cargo --version
Press Enter. If Cargo is installed correctly, you will see something like this:
cargo 1.100.0 (3acc79c0c 2026-11-05)
The output tells you three things:
- The name of the tool -
cargo, so you know the command reached the right program. - The version number -
1.100.0in this example. This is the current stable release (November 2026). Your number may be newer; that is fine. - A commit identifier and date - the part in parentheses, like
(3acc79c0c 2026-11-05), is a short hash of the source code used to build this Cargo release, plus the date it was compiled. You do not need to understand the hash; it just uniquely identifies the exact build.
Seeing this output means the cargo executable is on your PATH (the list of folders your operating system searches when you type a command) and can run.
A Shorter Alias: cargo -V
Cargo also accepts a single-letter uppercase flag for version:
cargo -V
This prints exactly the same information as cargo --version. The uppercase V is the conventional short form for "version" in many command-line tools. Both commands are equivalent and safe to use in scripts, documentation, or quick checks.
cargo -V
Output:
cargo 1.100.0 (3acc79c0c 2026-11-05)
Lowercase v Means Something Different:
Do not type cargo -v (lowercase v) when you want to see the version. Lowercase v is the verbose flag. It makes Cargo print extra details about what it is doing during a build. If you run cargo -v without a subcommand, you will see a help message, not the version number. The correct short flag is uppercase -V.
Getting Even More Detail with --verbose
If you want to see more about the exact build of Cargo that is installed, you can combine --version with --verbose:
cargo --version --verbose
The output is longer and includes details about the host platform, linked libraries, and operating system:
cargo 1.100.0 (3acc79c0c 2026-11-05)
release: 1.100.0
commit-hash: 3acc79c0c841844675bc53a605922dbfc441e750
commit-date: 2026-11-05
host: x86_64-pc-windows-msvc
libgit2: 1.9.6 (sys:0.21.0 vendored)
libcurl: 8.21.0-DEV (sys:0.4.90+curl-8.21.0 vendored ssl:Schannel)
os: Windows 10.0.22631 (Windows 11 Professional) [64-bit]
Every line provides useful information:
- release - the human-readable version string.
- commit-hash - the full Git commit hash of the Cargo source code. This uniquely identifies the exact snapshot from which your Cargo was built.
- commit-date - when that commit was created.
- host - the target triple describing your CPU and operating system. For example,
x86_64-pc-windows-msvcmeans a 64-bit Windows machine using the MSVC toolchain. - libgit2 and libcurl - versions of embedded C libraries that Cargo uses internally for fetching dependencies and interacting with Git repositories. The word
vendoredmeans these libraries are included with Cargo itself, so you do not need to install them separately. - os - the human-friendly name and version of your operating system.
This verbose output is rarely needed for everyday work, but it is valuable when reporting a bug or checking whether your Cargo installation is complete. If any of these fields are missing or look wrong, something may be off with your Rust installation.
Where You Should Run This Command
Cargo is a global command. You can run cargo --version from any directory on your system - it does not matter whether you are inside a Rust project, your home folder, or a completely empty directory. The version check does not depend on project files.
However, the command must be run from a terminal or command prompt. The exact steps to open a terminal differ by operating system:
- Windows: Open the Start menu, type
powershellorPowerShell, and press Enter. - macOS: Press
Command + Space, typeTerminal, and press Enter. - Linux: Most desktop environments have a terminal application; you can usually find it in the applications menu or launch it with
Ctrl + Alt + T.
Once the terminal is open, simply type the command and press Enter.
Terminal vs. Code Editor:
If you are using VS Code or another editor, you can open an integrated terminal from the menu (View → Terminal). That terminal behaves exactly like the system terminal and is a convenient place to run cargo --version.
A Step-by-Step Verification Walkthrough
To make the process clear, here is a complete sequence you can follow. Each step depends on the previous one being finished.
Step 1: Open a Terminal
Launch your preferred terminal application. On Windows, use Command Prompt or PowerShell. On macOS or Linux, use the built-in terminal. Make sure you see a command prompt waiting for input.
Step 2: Run the Version Command
Type the following exactly, then press Enter:
cargo --version
Do not add any extra spaces or characters before or after the command.
Step 3: Read the Output
You should see a line starting with cargo followed by a version number and a parenthesized hash/date. For example:
cargo 1.100.0 (3acc79c0c 2026-11-05)
If you see this, Cargo is installed and ready to use.
Step 4: Handle the Case Where the Command Is Not Found
If instead you see an error like:
'cargo' is not recognized as an internal or external command
or:
command not found: cargo
then Cargo is not on your PATH. This usually means the Rust installation did not complete, or you opened a new terminal before the installer updated your environment. Re-run the installer or restart your terminal, then try again.
You Are Good to Go:
If cargo --version prints a version number, your Rust toolchain contains both the compiler (rustc) and the package manager (Cargo). You now have everything needed to create and build Rust projects.
Common Beginner Mistakes
Even a command as simple as cargo --version has a few traps that can confuse new users.
Mistake 1: Assuming cargo version Without Two Dashes Is an Error
Some beginners assume that because cargo --version works, cargo version must be wrong. On current Cargo it is not an error at all: Cargo has a built-in version subcommand, so cargo version prints the same version line as cargo --version. (On very old Cargo releases it did fail with error: no such command: \version`- that is where this confusion comes from.) Either form works, butcargo --version(or the short-V`) is the standard form you will see in documentation, so prefer it.
cargo version
Output:
cargo 1.100.0 (3acc79c0c 2026-11-05)
Stick With the Standard Form:
Even though cargo version works on current Cargo, use cargo --version or cargo -V in scripts and documentation. Those are the forms every Rust developer recognises, and they work on every Cargo version.
Mistake 2: Using Lowercase v Instead of Uppercase V
We already touched on this, but it deserves emphasis. The command cargo -v (lowercase) is a valid flag, but it means verbose, not version. If you run it alone, Cargo prints its help text with a note that -v is used to increase verbosity. The version flag is uppercase -V.
Mistake 3: Assuming Cargo Is Installed Because rustc Works
It is extremely rare, but it is possible to have rustc without Cargo. This can happen if you installed Rust using a method that does not include the full standard toolchain, or if you manually removed Cargo from your system. Always check both commands after a fresh installation:
rustc --version
cargo --version
If rustc works but cargo does not, you need to reinstall Rust or add Cargo to your PATH. The most reliable fix is to run the rustup installer again - it will detect the missing component and install it.
Mistake 4: Running the Command from the Wrong Place
New users sometimes think they need to be inside a Rust project directory to use Cargo commands. That is not true for cargo --version. It works from any location. The version check is a global query; it does not read or modify any project files.
What the Version Number Tells You
Rust uses a release train model. The version number you see from cargo --version corresponds to the stable release of the Rust toolchain that is currently active. For example, if you see cargo 1.100.0, that means Cargo version 1.100.0 is installed. Cargo and rustc share the same version number within a toolchain release - when you install or update Rust, both rustc and cargo move to the new version together.
The version number is useful when:
- Searching for documentation or tutorials that match your Cargo version.
- Reporting a bug to the Cargo or Rust team.
- Determining whether a feature you want to use is available in your installed Cargo.
- Checking that an update you ran actually took effect.
After running cargo --version, you can verify that the number matches the latest stable release by visiting the Rust release announcements. If your version is much older, you may want to update your toolchain later.
Cargo and rustup Toolchains
rustup manages multiple Rust toolchains on your computer - stable, beta, nightly, or specific versions. The Cargo command you run in your terminal is actually a proxy provided by rustup. It determines which toolchain is active and then runs the Cargo binary from that toolchain.
This means cargo --version shows the version of Cargo for the active toolchain. If you switch toolchains using rustup default or rustup override, the version reported by cargo --version may change accordingly. For a beginner, the important point is simple: as long as you have installed Rust with rustup and not changed any toolchain settings, the Cargo version you see is the stable release version.
No Need to Worry About Toolchains Yet:
You do not need to understand toolchains right now. Just know that rustup controls which Cargo is used, and the version command tells you exactly what is active. This becomes relevant only when you start experimenting with nightly features or older Rust versions.
Checking Cargo in Scripts and Automation
Sometimes you need to check the Cargo version programmatically - for example, in a build script or a CI (Continuous Integration) pipeline. You can capture the output of cargo --version and use it in a script.
On a Unix-like shell (macOS, Linux, or Git Bash on Windows):
CARGO_VERSION=$(cargo --version)
echo "Cargo version is: $CARGO_VERSION"
On Windows PowerShell:
$cargoVersion = cargo --version
Write-Output "Cargo version is: $cargoVersion"
These snippets run the same command and store its text output in a variable. The output is exactly what you would see if you typed the command manually. Automating the version check is useful for logging or ensuring a minimum version is installed before proceeding with a build.
Do Not Parse the Version Number Casually:
If you need to compare Cargo versions in a script, do not rely on simple string matching. Version numbers are not zero-padded, so plain text comparison orders 1.10.0 before 1.9.0, which is numerically backwards. Use a version-aware comparison instead, such as sort -V on macOS and Linux or the [version] type in PowerShell. For most beginners, simply printing the version is enough.
Troubleshooting: When cargo --version Fails
If you follow the steps and the command does not produce the expected output, here is what to check.
The command is not found
This is the most serious problem. It means your terminal cannot locate the cargo executable. Possible causes:
- You installed Rust, but the installation did not update your
PATHenvironment variable. Restart your terminal or log out and back in, then try again. - You used a custom installation method that installed Cargo to a non-standard location. Find where
cargois installed and add that directory to yourPATH. - You are using a very old or unusual operating system where the installer failed silently. Re-run the installer and watch for errors.
The version number looks wrong or very old
If cargo --version prints a version that is much older than the current stable release, your Rust installation may be outdated. This is not an immediate problem, but you may want to update later. The fix is to use the rustup update command, which will bring both rustc and cargo up to date. (That command is covered separately in this documentation.)
The command works but prints a lot of extra text
If you accidentally typed cargo -v instead of cargo -V, you will see verbose help output. Just run the correct command again. Always use cargo --version or cargo -V.
Cargo runs but hangs or crashes
This is extremely rare for a simple version check. If cargo --version causes your terminal to freeze or print an error about internal libraries, your Cargo binary may be corrupted. The safest fix is to reinstall the Rust toolchain:
rustup toolchain uninstall stable
rustup toolchain install stable
This removes and then reinstalls the stable toolchain, including Cargo.
Do Not Ignore a Failing Version Check:
A broken cargo --version almost always means a broken Rust installation. Do not try to build projects or run other Cargo commands until the version check works. Fixing Cargo first will save you from confusing build errors later.
A Quick Reference Card
Here are the three commands you should remember for checking Cargo's version, from most to least commonly used:
| Command | Description | Typical Output |
|---|---|---|
cargo --version | Standard version check | cargo 1.100.0 (3acc79c0c 2026-11-05) |
cargo -V | Short alias, same output | cargo 1.100.0 (3acc79c0c 2026-11-05) |
cargo --version --verbose | Detailed build information | Multi-line output with host, libraries, and OS details |
Use the first one in most situations. Use the verbose form when you need to report a problem or inspect the exact build configuration.
The Role of This Check in Your Learning Path
Verifying Cargo is a small but essential step. You already confirmed that the Rust compiler works. Now you have confirmed that the package manager and build tool are also present. These two tools - rustc and cargo - are the foundation of every Rust project you will create.
Before moving on to writing actual Axum code, you should also verify that your development environment can keep these tools up to date. The next logical check is to ensure you can update the Rust toolchain itself, which ensures you always have the latest stable features and security fixes. But for now, take a moment to appreciate that your machine is ready to build Rust software.
Your Rust Environment Is Functional:
If both rustc --version and cargo --version produce correct version numbers, your Rust installation is complete. You can now confidently move forward to creating your first Axum project.
Summary
Checking Cargo's version with cargo --version is the simplest way to confirm that the Rust package manager and build tool are installed and working. The command prints the version number and a commit identifier, and the verbose variant gives even more detail about the build. The most common mistakes are using lowercase v instead of uppercase V, or assuming Cargo is present just because rustc works. By running this command successfully, you have proven that your Rust environment is ready for real project development.
One last check ties the two tools together: compare the version from cargo --version with the one from rustc --version. On a machine managed by rustup, the two numbers match, because both tools come from the same toolchain release. If they ever disagree, the commands are coming from different installations, and the active toolchain is the first thing to inspect.