'rustup gives command not found error with zsh even after installing with brew
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.
Solution 1:[1]
Solution 2:[2]
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 .zhrc use
nano ~/.zshrc
- Add
export PATH="$HOME/.cargo/bin:$PATH"
to .zhrc
- To open .zhrc use
Check if the installation was successfull using
rustc --version
All the best! :)
Solution 3:[3]
To configure your current shell, run
source $HOME/.cargo/env
this command FINALLY completed the painful installation of Rust.
Solution 4:[4]
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!
Solution 5:[5]
-make sure you has install rust successfully first setup
brew install rustup
$ source ~/.zshrc ,ro, source /.bashrc (refreshing terminal)
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 .zhrc
after that
please run $ source ~/.zshrc
,ro, $ source /.bashrc
(refreshing terminal)
To start a new project, navigate to where you want your project to be created then simply run cargo new . In my case I have decided to name my project "todo-cli" so I can run:
$ cargo new todo-cli
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Penny Liu |
Solution 2 | lAaravl |
Solution 3 | Nand |
Solution 4 | dimitris tseggenes |
Solution 5 | doctorlee |