Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without having a garbage collector, making it useful for embedded and bare-metal development, integration with other languages, and writing low-level code like device drivers and operating systems.
Cargo
handles dependencies, building, testing, and documentation.Rust installation is managed through a tool called rustup
, which makes it easy to install and update Rust and associated tools.
To install Rust on Linux, macOS, or another Unix-like OS, run this command in your terminal:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
This command downloads a script and starts the installation. You might be prompted to customize your installation, but the default options are suitable for most users.
After installation completes, you'll need to add Rust to your system PATH. The installer should offer to do this automatically, but if you need to do it manually, add this to your shell profile (like ~/.bashrc
or ~/.zshrc
):
export PATH="$HOME/.cargo/bin:$PATH"
Then restart your terminal or run source ~/.bashrc
(or your appropriate shell config file).
To verify that Rust was installed correctly, run:
rustc --version
cargo --version
Both commands should display their version information.
The installation includes:
rustc
: The Rust compilercargo
: Rust's package manager and build systemrustup
: The Rust toolchain installer and version managerTo keep Rust updated to the latest version, run:
rustup update
If you need to uninstall Rust and all its components, run:
rustup self uninstall
Now that you have Rust installed, you might want to: