Rename the default Cargo binary to be different than the package name

Chris Biscardi
InstructorChris Biscardi

Share this video with your friends

Send Tweet

In ./target/debug/ we can see the binary name: digital-garden-steps. This is the name of our package and we want the actual binary that users install to be named garden instead.

To do this we can change the auto-discovered src/main.rs binary and change the name using a bin config in the Cargo.toml file.

[[bin]]
name = "garden"
path = "src/main.rs"

Then we see ./target/debug/garden get created when we cargo run or cargo build.