インストール
途中でオプションを聞かれるが、とりあえず1を選べばいいと思う。
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
...
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
...
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"
PATHを通す
$ source "$HOME/.cargo/env"
~/.cargo/env (line 4): 'case' builtin not inside of switch block
case ":${PATH}:" in
^~~^
from sourcing file ~/.cargo/env
source: Error while reading file '/Users/kotaro/.cargo/env'
素直にsource "$HOME/.cargo/env"
を実行するとエラーになるが要はPATHさえ通れば良いので、fish_add_path
を実行すれば良い。
$ fish_add_path $HOME/.cargo/bin
$ rustc -V
rustc 1.75.0 (82e1608df 2023-12-21)
参考
https://doc.rust-lang.org/book/ch01-01-installation.html
https://github.com/rust-lang/rustup/issues/478#issuecomment-1288194464