I have installed an older R version using the source on a mac, but I am finding it difficult to get Rstudio to see this version. Is there an easy way to enable this
technocrat: you are correct, but I want to be able to switch between two different versions of R not downgrade permanently
mara: I have tried R switch but I had to install version 3.4.1 from source and Rswitch looks for the R version in /Library/Frameworks/ and is not able to find the source installation. I am also not finding a way to ask it to look in a different location.
This article talks about how to use a different version of R with RStudio Desktop:
The procedure is indeed system dependent. Here’s an excerpt of the section on R compiled from source on macOS:
R from source (including MacPorts and Homebrew)
When R is installed from CRAN on OS X the R executable is installed at /usr/bin/R . However, if R is installed directly from source or via a package manager like MacPorts or Homebrew, then the R executable is installed to either /usr/local/bin/R (Homebrew) or /opt/local/bin/R (MacPorts). In order to support these variations, RStudio scans for the R executable in the following sequence:
/usr/bin/R
/usr/local/bin/R
/opt/local/bin/R
If RStudio is not able to locate R by scanning these locations, it will fall back to using whatever version of R is located at /Library/Frameworks/R.framework/ .
If you want to override the version of R selected by RStudio's default behavior then you can set the RSTUDIO_WHICH_R environment variable to the R executable that you want to run against. For example, to force RStudio to use the R executable located at /usr/local/bin :
export RSTUDIO_WHICH_R=/usr/local/bin/R
Note that in order for RStudio to see this environment variable it needs to be launched from a terminal where the variable has been set to the desired value and exported.