Rust CLI Cheat Sheet/Initialize Cargo in an existing directory

Create a manifest in the current project folder.

Section: Create projects

Initialize Cargo in an existing directory

bash
bash
cargo init
Explanation

Useful when you already created the folder or are converting existing code.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Create projects
Initialize as library
Create a library package in the current directory.
OpenIn sheetbashsame section
Create a new binary crate
Generate a new package for an executable.
OpenIn sheetbashsame section
Create a new library crate
Generate a reusable library package.
OpenIn sheetbashsame section
Locate the manifest
Print the path to the Cargo.toml file Cargo will use.
OpenIn sheetbashsame section
Inspect package metadata
Emit machine-readable package metadata.
OpenIn sheetbashsame section
Show Cargo help
Display top-level help for Cargo.
OpenIn sheetbash1 tag match