+++ title = "Installing Rust" date = 2023-03-20T17:37:40Z weight = 1 +++ Since this book is about learning Rust, primarily in a microservices environment, this chapter focuses on installing Rust and describing the tools available to the developer. The easiest way to install Rust is to install the [Rustup](https://rustup.rs/) tool. It is one of those blind-trust-in-the-safety-of-the-toolchain things. For Linux and Mac users, the command is a shell script that installs to a user's local account: ``` sh $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` Once installed, you can install Rust itself: ``` sh $ rustup install toolchain stable ``` You should now have Rust compiler and the Rust build and packaging tool, known as Cargo: ``` sh $ rustc --version rustc 1.68.0 (2c8cc3432 2023-03-06) $ cargo --version cargo 1.68.0 (115f34552 2023-02-26) ``` I also installed the following tools: ``` sh $ rustup component add clippy rust-src rust-docs $ cargo install rustfmt rust-analyzer ``` - clippy: A powerful linter that provides useful advice above and beyond the compiler's basic error checking. - rustfmt: A formatting tool that provides a common format for most developers - rust-analyzer: For your IDE, rust-analyzer provides the LSP (Language Server Protocol) for Rust, giving you code completion, on-the-fly error definition, and other luxuries.