Skip to content

Install script should put rust path in ~/.zprofile on macOS #4772

Open

Description

@JonasEngstrom

Verification

Problem

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

  1. Run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  2. Restart Terminal, without manually sourcing the ~/.profile file.
  3. 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.

Notes

No response

Rustup version

rustup 1.29.0 (28d1352db 2026-03-05)

Installed toolchains

stable-aarch64-apple-darwin

OS version

macOS Tahoe version 26.3.1 (a)

Activity

  1. rami3l commented on Mar 24, 2026

    @rami3l
    Member

    @JonasEngstrom Thanks for reporting.

    Support for zprofile has been removed 6 years ago by the then-rustup team, I don't think it's needed any more: #2387

    Instead for zsh we are editing .zshenv directly:

    fn rcfiles(&self, process: &Process) -> Vec<PathBuf> {
    [Zsh::zdotdir(process).ok(), process.home_dir()]
    .iter()
    .filter_map(|dir| dir.as_ref().map(|p| p.join(".zshenv")))
    .collect()
    }

    What issue have you encountered in particular with the environment setup?

  2. JonasEngstrom commented on Mar 26, 2026

    @JonasEngstrom
    Author

    @rami3l Thank you for your prompt reply!

    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.

  3. rami3l commented on Mar 27, 2026

    @rami3l
    Member

    @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.?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions