I understand that rustup installs the rustc and cargo binaries to ~/.cargo/bin, but where does it install the rustup executable to? As far as I can tell this isn't explained in any documentation and running the installer doesn't tell you either. I'd like to avoid it being installed to anywhere except my home directory, if possible. I'm using macOS if that makes a difference.
- 388,571
- 95
- 1,107
- 1,366
- 14,931
- 9
- 45
- 70
-
`rustup which rustup` tells you where the rustup executable is! – Unapiedra Oct 31 '20 at 00:21
3 Answers
By default, rustup is also installed to your home directory:
$ which rustup
/Users/shep/.cargo/bin/rustup
The documentation states:
rustupinstallsrustc,cargo,rustupand other standard tools to Cargo'sbindirectory. On Unix it is located at$HOME/.cargo/binand on Windows at%USERPROFILE%\.cargo\bin. This is the same directory thatcargo installwill install Rust programs and Cargo plugins.
It goes on to describe how to change the defaults:
rustupallows you to customise your installation by setting the environment variablesCARGO_HOMEandRUSTUP_HOMEbefore running the rustup-init executable. As mentioned in the Environment Variables section,RUSTUP_HOMEsets the root rustup folder, which is used for storing installed toolchains and configuration options.CARGO_HOMEcontains cache files used by cargo.
- 10,344
- 3
- 26
- 37
- 388,571
- 95
- 1,107
- 1,366
-
fwiw I tried installing via the standalone msi. It does not install in the default location as described and I didn't bother to check where it was installed because my path was also not updated as expected. So I uninstalled it then chose the appropriate exe under https://forge.rust-lang.org/infra/other-installation-methods.html#other-ways-to-install-rustup. This worked fine – aaaaaa Jan 07 '21 at 04:07
In my case rustup (along with it's installed toolchains) is in a folder named .rustup which is on the same level as .cargo
- 21
- 1
If you used Chocolatey to install Rust, it installs to C:\ProgramData\chocolatey\bin (at least when I used it).
To verify it was installed by Chocolatey, in a PowerShell window run choco list --local-only and see if the returned list contains Rust.
You can uninstall Chocolatey's Rust instance by running choco uninstall rust in an admin PowerShell window.
- 388,571
- 95
- 1,107
- 1,366
- 299
- 3
- 6
-
5Does Chocolatey install **rustup**? That's what this question is about: *Where does rustup install itself to?* This question isn't about `rustc` in general. – Shepmaster Apr 05 '21 at 16:43
-
It doesn't, but this is the first question/answer that comes up when you [google "where does rust install itself?"](https://www.google.com/search?q=where+does+rust+install+itself&oq=where+does+rust+install+itself). I guess I didn't read the whole question, but this answer seems likely to help others to me. – Kyle Stay Apr 05 '21 at 22:59