How/where does rustup export the PATH variable?

1.3k Views Asked by At

What is the mechanism that rustup uses to set the PATH variable? I couldn't find any entry in my .bashrc.

3

There are 3 best solutions below

1
On

Apparently the PATH variable is exported in .profile in the user home directory:

export PATH="$HOME/.cargo/bin:$PATH"
0
On

The following command works on Mac:

source $HOME/.cargo/env

0
On

I'm using rustup installed by package manager(pacman) to manage rust environment in Arch Linux, at first I don't know how does it set PATH. Then I run pacman -Ql rustup to list all files the package has installed and found there's a file /etc/profile.d/rustup.sh and its content:

export PATH=$PATH:/usr/lib/rustup/bin

So it's a global profile file and all shells will source it. I don't know which distro you are using but it must be in similar condition.