[Rust Docker] Use brew to install Rust on macOS

Rust with Homebrew on macOS

Homebrew is the Missing Package Manager for macOS (or Linux).

Rust is a language empowering everyone to build reliable and efficient software.

This article is about how to brew to install Rust on macOS.

Prerequisites

  • Xcode Command Line Tools
    The Xcode Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS which is consists of the macOS SDK and command-line tools such as Clang, which are installed at this

    For more information about installing and using Xcode Command Line Tools, see the Xcode Command Line Tools

  • Homebrew
    Homebrew is the Missing Package Manager for macOS (or Linux).

    For more information about installing and using Homebrew, see the Homebrew - https://brew.sh/.

Installation

Install Rust package.

1
2
3
4
$ brew install rust

# Or install rustup-init. Also known as: rustup
# $ brew install rustup-init

Check rustc and cargo version.

1
2
3
4
5
$ rustc --version
rustc 1.52.1 (9bc8c42bb 2021-05-09)

$ cargo --version
cargo 1.52.0 (69767412a 2021-04-21)

References

[1] rust — Homebrew Formulae - https://formulae.brew.sh/formula/rust

[2] rustup-init — Homebrew Formulae - https://formulae.brew.sh/formula/rustup-init

[3] Homebrew - https://brew.sh/

[4] Rust Programming Language - https://www.rust-lang.org/