I just upgraded RStudio for OSX to V1.1.456, and it does not recognize the R_LIBS_USER set in my .bash_profile. R from the console has no such problem. When I open RStudio, ignores my environment variable
R_LIBS_USER=/Users/bill/Library/R/3.4/library
so my libraries aren't available and the .rproj files fail. Rstudio seems to be making up its own R_LIBS_USER location, which doesn't exist:
Desktop applications in general will not read the values set in a startup shell profile (e.g. .bash_profile). You should instead set this variable within a file located at ~/.Renviron -- this ensures all R sessions (whether living in a shell or not) will get the requested library.
Also worth saying: RStudio appears to be setting the default library paths for R 3.5, while you want to use packages compiled for R 3.4. It's not advisable to use R packages compiled for a different version of R than the one currently in use.
Thanks Kevin,
I'll change the ~/.Renviron immediately.
I used macOS package "updateR" from GitHub to move to R3.5.1, and it updates R_LIBS_USER in place. So I have 3.5 packages replacing the 3.4 packages in that directory.
EDIT:
After I restarted the same problem (libPaths() occurred. So RStudio on macOS does not appear to recognize R_LIBS_USER in .Renviron: