Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeeDDHH/c2d81f363b9d4e48ad0b686a8525e5c0 to your computer and use it in GitHub Desktop.
Save LeeDDHH/c2d81f363b9d4e48ad0b686a8525e5c0 to your computer and use it in GitHub Desktop.
Rustの推奨された方法でMacにインストールする

Rustの推奨された方法でMacにインストールする(2021/8/4)

推奨されているインストール方法

homebrewではなく、ターミナルから直接Rustのインストール用のshellファイルをダウンロードして実行する

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | 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.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  /Users/ユーザー名/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  /Users/ユーザー名/.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  /Users/ユーザー名/.cargo/bin

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

  /Users/ユーザー名/.profile
  /Users/ユーザー名/.zshenv

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 (default)
               profile: default
  modify PATH variable: yes

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

1を選ぶ

以下のコマンドがインストールされる

cargo
cargo-clippy
cargo-fmt
cargo-miri
clippy-driver
rls
rust-gdb
rust-lldb
rustc
rustdoc
rustfmt
rustup

環境設定の見方

Rustの環境設定 説明
$HOME/.rustup rustupのメタデータとツールチェーンがインストールされる
$HOME/.cargo cargoで使えるバイナリと環境設定が入っている
$HOME/.cargo/bin cargo, rustc, rustupなどのコマンドが入る
$HOME/.profile
$HOME/.zshenv
cargoなどのコマンドが使えるように PATH 環境変数の読み込み用のファイル

Rustをアンインストールする場合のコマンド

rustup self uninstall

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment