Some further commentary on proper hygene of the R library search path (especially w/r/t MacOS)
Only put stable, universal packages in the default R system library (
/Library/Frameworks/R.framework/Resources/library). Write protect it to enforce this policy.
- By default, not-root has write permissions to the default R system library
- There’s no way to remove the default R system library from R’s search path, that I can tell, on Mac OS.
- If a package is present at the default R system library,
biocLitewill try to update and over-write the package at this location, rather than adding a new version at
R_LIBS_USER. Hence ignoring the search order in
- Therefore, to avoid unintentionally altering your configuration, change the permissions of the R system library so that you can’t casually write there (eg with
sudo chmod -R 755 /Library/Frameworks/R.framework/Resources/library)
- Now, however, if a package is present in the now write-protected site library,
install.packageswill moan and die about a lack of permissions, rather than falling back (well, actually forward) to a write-able, higher-order location in
- Therefore, move all packages that you might have to manage on a per-project basis to a separate, user-writable folder, and set this as R_LIBS_USER in your .Renviron file.
- Now you may override or add to this value on a per-project basis.