Getting started with Rust, installation
Let's set up our Rust development environment. We will use Rustup / Cargo as our installer and package manager.
Let’s set up our Rust development environment,
Playground
You can play Rust online, without installing anything. Play Rust Lang
Installing Rustup
The recommended way to install Rust is using Rustup. It’s both installer and version manager for Rust
For macOs / Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Using other OS? check other installation method here
Update current version
Rust updates frequently. Run rustup update
to user the latest update.
What is Cargo
When we install Rustup, we also install Cargo. It does a lot of things
- build your project with
cargo build
- run your project with
cargo run
- test your project with
cargo test
- build documentation for your project with
cargo doc
- publish a library to crates.io with
cargo publish
To make sure everything is installed. Run cargo --version
Make it nice on your text editor
Whatever text-editor you use, make sure to install Rust support (syntax highlight or snippets) to make your experience better
Fun Fact
When you install Rust, it also copy the documentation locally to read offline.
Try rustup doc
to open it in browser (locally).
Want to uninstall?
You can run
rustup self uninstall