You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Install script should put rust path in ~/.zprofile on macOS #4772
Running the installation script from the rust-lang.org install page on macOS adds . "$HOME/.cargo/env" to ~/.profile rather than ~/.zprofile where it needs to be to work.
Steps
Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Restart Terminal, without manually sourcing the ~/.profile file.
Rust will not run until ~/.profile is manually sourced or . "$HOME/.cargo/env" is moved to ~/.zprofile.
Possible Solution(s)
Have the setup script add . "$HOME/.cargo/env" to ~/.zprofile instead of ~/.profile on macOS specifically.
I was not aware that .zprofile had previously been supported, as I am rather new to Rust. (Hence the recent install.)
The issue I am having is that I need to manually source .zshenv or run the command . "$HOME/.cargo/env" every time I open a new terminal. Adding the line to .zprofile solved the problem for me. I was also able to remove the .zshenv file entirely, as it contained nothing except the command mentioned above.
I would not be surprised if it is an issue with my particular setup, but as far as I can remember I have not reconfigured Z shell apart from adding a few directories to the PATH etc and I am thus running it with pretty much a default configuration. That is why I assumed it was an issue with the install script.
The shells I use are either in the macOS Terminal app or from within VS Code.
Would you mind digging into your configuration a bit, say adding an "echo" to .zshenv and see if something happens, and/or remove your path configuration to see if it has changed anything etc.?
Activity
rami3l commentedon Mar 24, 2026
@JonasEngstrom Thanks for reporting.
Support for
zprofilehas been removed 6 years ago by the then-rustup team, I don't think it's needed any more: #2387Instead for zsh we are editing
.zshenvdirectly:rustup/src/cli/self_update/shell.rs
Lines 200 to 205 in dfc31fe
What issue have you encountered in particular with the environment setup?
JonasEngstrom commentedon Mar 26, 2026
@rami3l Thank you for your prompt reply!
I was not aware that
.zprofilehad previously been supported, as I am rather new to Rust. (Hence the recent install.)The issue I am having is that I need to manually source
.zshenvor run the command. "$HOME/.cargo/env"every time I open a new terminal. Adding the line to.zprofilesolved the problem for me. I was also able to remove the.zshenvfile entirely, as it contained nothing except the command mentioned above.I would not be surprised if it is an issue with my particular setup, but as far as I can remember I have not reconfigured Z shell apart from adding a few directories to the PATH etc and I am thus running it with pretty much a default configuration. That is why I assumed it was an issue with the install script.
The shells I use are either in the macOS Terminal app or from within VS Code.
rami3l commentedon Mar 27, 2026
@JonasEngstrom I don't use zsh myself but as per ohmyzsh/ohmyzsh#4928 this file should have been loaded.
Would you mind digging into your configuration a bit, say adding an "echo" to .zshenv and see if something happens, and/or remove your path configuration to see if it has changed anything etc.?