実施環境
CPU: Apple M1 Pro
OS: 13.4
shell: fish
Install
に従い以下のコマンドを実行
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ✘ 0|INT 42s 07:03:48
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/republicofkorokke/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
/Users/republicofkorokke/.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/republicofkorokke/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/Users/republicofkorokke/.profile
/Users/republicofkorokke/.zshenv
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: aarch64-apple-darwin
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
info: profile set to 'default'
info: default host triple is aarch64-apple-darwin
info: syncing channel updates for 'stable-aarch64-apple-darwin'
info: latest update on 2023-04-20, rust version 1.69.0 (84c898d65 2023-04-16)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
26.1 MiB / 26.1 MiB (100 %) 14.2 MiB/s in 1s ETA: 0s
info: downloading component 'rustc'
51.5 MiB / 51.5 MiB (100 %) 14.6 MiB/s in 3s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
13.4 MiB / 13.4 MiB (100 %) 4.9 MiB/s in 1s ETA: 0s
info: installing component 'rust-std'
26.1 MiB / 26.1 MiB (100 %) 19.2 MiB/s in 1s ETA: 0s
info: installing component 'rustc'
51.5 MiB / 51.5 MiB (100 %) 21.9 MiB/s in 2s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-aarch64-apple-darwin'
stable-aarch64-apple-darwin installed - rustc 1.69.0 (84c898d65 2023-04-16)
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source "$HOME/.cargo/env"
一番下に「今のshellでPATH通したいならsource “$HOME/.cargo/env”しろ」 とありますが
fish用の記述になっていないので実行してもエラーになります
fishでPATHを通すにはconfig.fishに以下を追記
fish_add_path $HOME/.cargo/bin
fishでPATHの追加方法は色々あるが、これが良いらしい
参考にしたサイト
最後に config.fish を読み込み直してcurgoが叩けるか確認
$ source ~/.config/fish/config.fish
$ cargo -V
cargo 1.69.0 (6e9a83356 2023-04-12)
導入はPythonより簡単でよかった