I installed rustup with brew command but still says that rustup command is not found. I am not sure if I am missing any installation step. Any help would be appreciated.
-
Was the `rustup` binary installed anywhere? I mean, does a file with that name exist on your computer? Also, was the installation successful or did it have messages at the end? – piojo May 23 '21 at 05:04
7 Answers
I used the following steps to install Rust on MacOS:
Install Rust using:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Make sure that you customize the installation and answer No when it asks to modify the Path.
Once successfully done, then add the Path variable to .zshrc using:
- To open .zshrc use
nano ~/.zshrc
- Add
export PATH="$HOME/.cargo/bin:$PATH"
to .zshrc
- To open .zshrc use
Check if the installation was successfull using
rustc --version
If that doesn't work right away then use the command:
source $HOME/.cargo/env
and rerunrustc --version
.
-
What happens if we leave `modify PATH variable: yes`? I've seen other people install it this way, and I don't undetstand what difference it makes. In what way are we or are we not modifying the `PATH` variable? – Matt Sep 05 '22 at 21:55
To configure your current shell, run
source $HOME/.cargo/env
this command FINALLY completed the painful installation of Rust.

- 611
- 6
- 12
Make sure you has install rust successfully first setup
$ brew install rustup
$ source ~/.zshrc
$ source /.bashrc
$ brew reinstall rustup-init
now you can run command line
$ rustup-init
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/location/.cargo
modify PATH variable: yes
- Proceed with installation (default)
- Customize installation
- Cancel installation
Nest Testing
To check if you have installed rust Succesful on your machine type the following command in your terminal
$ rustc
Once successfully done, then add the Path variable to .zshrc using:
To open .zhrc
use
$ nano ~/.zshrc
or
$ open . ~/.zshrc
Add
export PATH="$HOME/.cargo/bin:$PATH"
to .zshrc
, after that
please run
$ source ~/.zshrc
$ source /.bashrc
To start a new project, navigate to where you want your project to be created then simply run cargo new <project-name>
. In my case I have decided to name my project "todo-cli" so I can run:
$ cargo new todo-cli

- 1,265
- 1
- 18
- 31

- 437
- 4
- 5
I had the same problem, because the PATH variable didn't include the Cargo's bin directory right after installation.
I closed and opened again the shell, and it worked!

- 3,031
- 2
- 16
- 23
Did you try to install rustup via https://rustup.rs/
That may work correctly on your computer.
-
The instructions say NOT to do this if you already have Rust installed. ``` warning: it looks like you have an existing installation of Rust at: warning: /usr/bin warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first. ``` – Raleigh L. Oct 05 '22 at 04:33
i faced this issue in Ubuntu on WSL
Ubuntu terminal environment on Windows with Windows Subsystem for Linux (WSL).
I just restarted the terminal.
Thats all.
In your case u may require to reboot.

- 3,153
- 2
- 33
- 42