Unable to find gcc installing rstan on Windows 10

Ah my bad… I assumed when I got the message “Do you want to install from sources the package which needs compilation?” message it meant I had to compile. I’ve never tried hitting no, or noticed the message about binaries being available.

I got matrixStats installed but and then ran into the “RMU” error dealt with in this thread: New error: cleanup_makevar(old) : argument "RMU" is missing, with no default. I change the name of the makevars file as per the solution in there, and tried stan_demo() and got the same message

C:/Rtools/mingw32/bin/gcc: No such file or directory

Using Sys.unsetenv("BINPREF") and then running stan_demo() worked! I restarted R and tried again but had to enter Sys.unsetenv("BINPREF") again - is there a step I can take so I don’t have to enter that command everytime I restart R? I’m new to working with path and system environmental variables, so I’m not sure what I’d need to do.