Installing Rust lang 1.27.2 on macOS High Sierra 10.13.6

If you search internet for “install rust macos” is is likely that the first entry in the list will be https://www.rust-lang.org/en-US/install.html  and the only instruction is to run the following in your terminal curl https://sh.rustup.rs -sSf | sh which is a classic minimal install of a command from internet. Searched a little bit and looked like Brew is not particularly used for this task, so I went away with:

$ curl https://sh.rustup.rs -sSf | sh
info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.

It will add the cargo, rustc, rustup and other commands to Cargo's bin
directory, located at:

/Users/anibal/.cargo/bin

This path will then be added to your PATH environment variable by modifying the
profile files located at:

/Users/anibal/.profile
/Users/anibal/.bash_profile

You can uninstall at any time with rustup self uninstall and these changes will
be reverted.

Current installation options:

default host triple: x86_64-apple-darwin
default toolchain: stable
modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>

At this point what are you going to do? Just press 1  and hit Enter  and…

info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: latest update on 2018-07-20, rust version 1.27.2 (58cc626de 2018-07-18)
info: downloading component 'rustc'
56.5 MiB / 56.5 MiB (100 %) 1.0 MiB/s ETA: 0 s
info: downloading component 'rust-std'
44.8 MiB / 44.8 MiB (100 %) 892.8 KiB/s ETA: 0 s
info: downloading component 'cargo'
3.2 MiB / 3.2 MiB (100 %) 1.1 MiB/s ETA: 0 s
info: downloading component 'rust-docs'
8.8 MiB / 8.8 MiB (100 %) 1.1 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: installing component 'rust-docs'
info: default toolchain set to 'stable'

stable installed - rustc 1.27.2 (58cc626de 2018-07-18)


Rust is installed now. Great!

To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done automatically.

To configure your current shell run source $HOME/.cargo/env

if we check our .bash_profile  file:

$ cat ~/.bash_profile | grep cargo
export PATH="$HOME/.cargo/bin:$PATH"

Indeed the installer appended the PATH  to be able to reach to Rust’s package manager: Cargo. To be able to use our fresh install within the same session we just do as suggested be by the installer:

$ source $HOME/.cargo/env

We check for cargo’s availability:

$ cargo --version
cargo 1.27.0 (1e95190e5 2018-05-27)

And we are good to start toying with Rust lang version  1.27.2 on macOS HIgh Sierra 10.13.6.

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer