Run cargo outdated to list dependencies with newer available versions, but first install the cargo-outdated subcommand since it is not included in the standard Rust toolchain. This tool compares your Cargo.toml and Cargo.lock against the crates.io registry to highlight version gaps without modifying your project files.
You need to install the binary globally using cargo install:
cargo install cargo-outdated
Once installed, navigate to your project directory and execute the command. By default, it shows all outdated packages, but you can filter for specific crates or check for pre-release versions:
# Show all outdated dependencies
cargo outdated
# Check only a specific crate (e.g., serde)
cargo outdated --package serde
# Include pre-release versions in the check
cargo outdated --include-pre
The output displays the current version, the latest available version, and the semver compatibility status. If the "Semver" column shows "breaking," upgrading might require code changes. You can also pipe the output to grep to quickly find specific issues, such as cargo outdated | grep breaking.
Note that cargo outdated reads the Cargo.lock file to determine what is currently installed. If you haven't run cargo build or cargo update recently, the lock file might not reflect the exact versions you intend to check. Additionally, this tool does not automatically update your dependencies; it only reports discrepancies. To actually update them, you must run cargo update or manually edit Cargo.toml and then run cargo update again.
If you encounter permission errors or "no such file" issues, ensure you are running the command from the root of your Cargo project where Cargo.toml exists. For projects using a custom registry or private crates, you may need to configure the CARGO_REGISTRIES environment variable or pass the --registry flag if the tool version supports it, though standard usage assumes the public crates.io index.