Do a cargo build With Your Current System Architecture in Rust

August 2025

Doing cargo build --release outputs to the default directory: ./target/release . I like doing this instead to explicitly include the architecture of the platform I'm using:

cargo build --release --target $(rustc --print host-tuple)

That outputs to this directory for me:

./target/aarch64-apple-darwin/release

Just the Architecture

You can use this if you just want to know the architecture you're currently on:

rustc --print host-tuple

which outputs this for me:

aarch64-apple-darwin
end of line