Skip to content
This repository was archived by the owner on Oct 26, 2023. It is now read-only.
This repository was archived by the owner on Oct 26, 2023. It is now read-only.

Alternative way to add rtools to PATH through .Renviron #26

@SamDeCraemer

Description

@SamDeCraemer

I tried to install this on a home and work pc (both windows 10 64bit) using the instruction provided at https://cran.r-project.org/bin/windows/Rtools/. In both cases I simply installed rtools40 in the default directory c:/rtools40. While setting the PATH then worked like a charm on the former pc, I had a lot of trouble on my work pc. I managed to find a solution but adding a comment to suggest this alternative might save some other people time.

For the latter pc creating an .Renviron file running the suggested code below, then reloading rstudio and rended up adding "\usr\bin" instead of "c:\rtools40\usr\bin":
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

The same happened when trying to append the rtools40 path at the end of PATH by running
writeLines('PATH="${PATH};${RTOOLS40_HOME}\\usr\\bin"', con = "~/.Renviron")

I checked the makeconf file of the R installation ,and the RTOOLS40_HOME variable was correctly set to c:/rtools40. For some reason Rstudio(?) was not able to extract this information however. In the end, I solved the problem by manually entering the directory I installed rtools40 to using the code below, this might be a good suggestion for people having trouble:
writeLines('PATH="${PATH};C:\\rtools40\\usr\\bin"', con = "~/.Renviron")

Note: for some reason, trying to use the last snippet but adding the rtools40 path before the existing path caused the whole PATH variable to become corrupt:
#DONOTRUN writeLines('PATH="C:\\rtools40\\usr\\bin;PATH="${PATH}"', con = "~/.Renviron")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions