Follow the instructions at https://www.rust-lang.org/tools/install. If that doesn't work for you there are other installation methods.
rustup and other standard tools to
bin directory. On Unix it is located at
$HOME/.cargo/bin and on
%USERPROFILE%\.cargo\bin. This is the same directory that
cargo install will install Rust programs and Cargo plugins.
This directory will be in your
$PATH environment variable, which means you
can run them from the shell without further configuration. Open a new shell
and type the following:
If you see something like
rustc 1.19.0 (0ade33941 2017-07-17) then you are
ready to Rust. If you decide Rust isn't your thing, you can completely remove
it from your system by running
rustup self uninstall.
Choosing where to install
rustup allows you to customise your installation by setting the environment
RUSTUP_HOME before running the
executable. As mentioned in the Environment Variables section,
sets the root
rustup folder, which is used for storing installed toolchains
and configuration options.
CARGO_HOME contains cache files used by cargo.
Note that you will need to ensure these environment variables are always set
CARGO_HOME/bin is in the
$PATH environment variable when using
If you specify the nightly channel when installing
rustup-init script will do a "forced" installation by default. A "forced"
installation means it will install the nightly channel regardless of whether
it might be missing components that you want. If you want to install rustup
with the nightly channel, and ensure it has the components that you want, you
will need to do this in two phases. For example, if you want to make a fresh
rustup and then install
nightly along with
miri, first install
rustup without a toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
Next you can install
rustup to downgrade until it finds
the components you need:
rustup toolchain install nightly --allow-downgrade --profile minimal --component clippy
This can be used to great effect in CI, to get you a toolchain rapidly which meets your criteria.
Enable tab completion for Bash, Fish, Zsh, or PowerShell
rustup now supports generating completion scripts for Bash, Fish, Zsh, and
rustup help completions for full details, but the gist is as
simple as using one of the following:
# Bash $ rustup completions bash > ~/.local/share/bash-completion/completions/rustup # Bash (macOS/Homebrew) $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion # Fish $ mkdir -p ~/.config/fish/completions $ rustup completions fish > ~/.config/fish/completions/rustup.fish # Zsh $ rustup completions zsh > ~/.zfunc/_rustup # PowerShell v5.0+ $ rustup completions powershell >> $PROFILE.CurrentUserCurrentHost # or $ rustup completions powershell | Out-String | Invoke-Expression
Note: you may need to restart your shell in order for the changes to take effect.
zsh, you must then add the following line in your