appendix Installing Rust

 

To get the most out of this book, you’ll need to have a functioning Rust toolchain installed. If you’ve never used Rust before, you’ll need to install a recent release of the Rust toolchain that includes the compiler and the standard library. You may also need to install some development tools, depending on your OS, to compile and run all the code samples included with this book.

A.1 Installing tools for this book

To compile and run the code samples provided in this book, you must install the necessary prerequisite dependencies.

A.1.1 Installing tools for macOS using Homebrew

$ brew install git

In macOS, you’ll need to install the Xcode command-line tools:

$ sudo xcode-select --install

A.1.2 Installing tools for Linux systems

To install tools for Debian-based systems, use this command:

$ apt-get install git build-essential

To install tools for Red Hat-based systems, use this command:

$ yum install git make automake gcc gcc-c++

To install rustup in Linux and UNIX-based operating systems, including macOS, use this command:

$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

When you’ve installed rustup, make sure that both the stable and nightly toolchains are installed:

$ rustup toolchain install stable nightly
...

A.1.3 Installing tools for Windows

A.2 Managing rustc and other Rust components with rustup

A.2.1 Installing rustc and other components

A.2.2 Switching default toolchains with rustup