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
In macOS, you’ll need to install the Xcode command-line tools:
$ sudo xcode-select --install
A.1.2 Installing tools for Linux systems
$ 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++
TIP You may want to install Clang rather than GCC, which tends to have better compile times.
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 ...