Rust Setup

Photo by Kevin Noble on Unsplash

Rust Setup

·

2 min read

I prefer using home-brew to manage the install package. So I'm used to searching first.

Home-brew

# check the info
brew info rustup-init 

# look good for me
==> rustup-init: stable 1.26.0 (bottled)
Rust toolchain installer
https://github.com/rust-lang/rustup
/usr/local/Cellar/rustup-init/1.26.0_1 (9 files, 7.2MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-08-09 at 11:10:05
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/rustup-init.rb
License: Apache-2.0 or MIT
==> Dependencies
Build: rust ✘
==> Analytics
install: 3,091 (30 days), 12,798 (90 days), 22,169 (365 days)
install-on-request: 2,710 (30 days), 11,985 (90 days), 21,110 (365 days)
build-error: 0 (30 days)
# install and instructions
brew install rustup-init


# print host info and modify PATH setting
Current installation options:
   default host triple: x86_64-apple-darwin
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

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

...

# Yes!
Rust is installed now. Great!

Config the current terminal env

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

Check

# check rustup command
rustup --help

# Yes!
rustup 1.26.0 (2023-04-05)
The Rust toolchain installer

USAGE:
    rustup [OPTIONS] [+toolchain] <SUBCOMMAND>

ARGS:
    <+toolchain>    release channel (e.g. +stable) or custom toolchain to set override

OPTIONS:
    -v, --verbose    Enable verbose output
    -q, --quiet      Disable progress output
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    show           Show the active and installed toolchains or profiles
    update         Update Rust toolchains and rustup
    check          Check for updates to Rust toolchains and rustup
    default        Set the default toolchain
    toolchain      Modify or query the installed toolchains
    target         Modify a toolchain's supported targets
    component      Modify a toolchain's installed components
    override       Modify directory toolchain overrides
    run            Run a command with an environment configured for a given toolchain
    which          Display which binary will be run for a given command
    doc            Open the documentation for the current toolchain
    man            View the man page for a given command
    self           Modify the rustup installation
    set            Alter rustup settings
    completions    Generate tab-completion scripts for your shell
    help           Print this message or the help of the given subcommand(s)

DISCUSSION:
    Rustup installs The Rust Programming Language from the official
    release channels, enabling you to easily switch between stable,
    beta, and nightly compilers and keep them updated. It makes
    cross-compiling simpler with binary builds of the standard library
    for common platforms.

    If you are new to Rust consider running `rustup doc --book` to
    learn Rust.