# Can't get stan() to run with R 4.0.2 despite hours of messing with Makevars.win

**URL:** <https://discourse.mc-stan.org/t/cant-get-stan-to-run-with-r-4-0-2-despite-hours-of-messing-with-makevars-win/18522>\
**Category:** RStan\
**Created:** [October 8, 2020, 4:20pm UTC](https://discourse.mc-stan.org/t/cant-get-stan-to-run-with-r-4-0-2-despite-hours-of-messing-with-makevars-win/18522 "2020-10-08T16:20:15Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![JohnKruschke](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/johnkruschke/32/21245_2.png) [@JohnKruschke](https://discourse.mc-stan.org/u/JohnKruschke)\
**Post date:** [October 8, 2020, 4:53pm UTC](https://discourse.mc-stan.org/t/cant-get-stan-to-run-with-r-4-0-2-despite-hours-of-messing-with-makevars-win/18522/3 "2020-10-08T16:53:48Z")

</div>

Thank you for your quick reply.

It made me smile when you said "You can see the issue in this line: `echo C:/Rtools/mingw_64/bin/g++ -shared`" because, of course, I do not have the expertise to see anything meaningful there. I’m very glad you can! :-)

I definitely have RTools **4** installed. Did that before, based on [https://cran.r-project.org/bin/windows/Rtools/](https://cran.r-project.org/bin/windows/Rtools/)

Here are the outputs of the commands you requested:

```
> Sys.getenv("PATH")
[1] "
C:\\rtools40\\usr\\bin;
C:\\Program Files\\R\\R-4.0.2\\bin\\x64;
C:\\Rtools\\bin;
C:\\Rtools\\bin;
C:\\Rtools\\mingw_32\\bin;
..."

> Sys.getenv("BINPREF")
[1] "C:/Rtools/mingw_$(WIN)/bin/"

> readLines("~/.R/Makevars.win")
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
  cannot open file 'C:/Users/John/Documents/.R/Makevars.win': No such file or directory

```

I removed Makevars.win based on advice in [New error: cleanup\_makevar(old) : argument "RMU" is missing, with no default](https://discourse.mc-stan.org/t/new-error-cleanup-makevar-old-argument-rmu-is-missing-with-no-default/18137/25)

```
> readLines("~/.Rprofile")
[1] "Sys.setenv(BINPREF = \"C:/Rtools/mingw_$(WIN)/bin/\")"
[2] "Sys.setenv(BINPREF = \"C:/Rtools/mingw_$(WIN)/bin/\")"

> readLines("~/.Renviron")
[1] "PATH=\"${RTOOLS40_HOME}\\usr\\bin;${PATH}\""

```

---

_[View the full topic](https://discourse.mc-stan.org/t/cant-get-stan-to-run-with-r-4-0-2-despite-hours-of-messing-with-makevars-win/18522)._
