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.