[Solved] Portable Rust Installation

I have an MSYS2 installation that runs off a USB flash drive. I use it this way because the workstation (laptop) I'm assigned changes when I'm in the field. I'm using it for usually small, situation dependent programs/calculators and to do bug fixes on a few specialized applications I wrote and maintain.

Is there a way to have a portable installation of rust on windows I can run with a batch script from my USB drive similar to how I run MSYS2?

Can I run it from within MSYS2?

I would like to start using rust, but I haven't found a way to make it portable like the gcc in MSYS2.


I don't think there's a ready-made solution, but Rust tools don't use Windows registry, and all the files and settings are stored in %USERPROFILE%\.rustup and %USERPROFILE%\.cargo directories.
If you copy those two to USB drive, set up RUSTUP_HOME and CARGO_HOME appropriately, and add %CARGO_HOME%\bin to your PATH, things should work.

1 Like

I copied the folders and added the PATH and set up the environment variables in the .bashrc file on my MSYS2 usb drive and it works fine so far. We'll have to see how it works when I use it in a new computer tomorrow.