For note, if you really want to install a local rust in addition to a system rust, I recommend
asdf. A quick setup example:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.4
Have your shell load it:
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
echo 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish
mkdir -p ~/.config/fish/completions; and cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
Then reload your shell, or source it, or whatever to load it.
Install a language plugin
Can run just
asdf for help.
List the officially supported plugins (can install others via git or filesystem or so):
Install rust's plugin:
asdf plugin-add rust
Install a rust version
Can list the versions it supports from rust specifically (it pulls from the main rust build distribution system):
asdf list-all rust
Let's install nightly:
asdf install rust nightly
You can set it to be used everywhere for your user with:
asdf global rust nightly
Or just for the current directory tree:
asdf local rust nightly
Can switch back to the system version with the special version named
asdf global rust system
You can install many versions of rust:
asdf install rust stable
asdf install rust 1.37.0
And can use them in many directories.
Do note, asdf only downloads for the x86 platform, no cross compiling or anything like that for that you will still want rustup or a docker container (I prefer docker for reproduciblity anywhere). But asdf is awesome for simple things like this (though I use rustup for rust, it's super useful for a lot of other languages and tools).