I am using R 3.5.2_2 under macOS, installed via Homebrew with Packrat 0.5.0.
When Homebrew upgrades R to a new version, a new library is created, living in /usr/local/Cellar/r/3.5.2_2/lib/R/library, in contrast to the previous one at /usr/local/Cellar/r/3.5.2/lib/R/library.
Issue
When opening a Packrat project that I previously created with an old version of R, I get this error:
In file.symlink(from, to) :
cannot symlink '/usr/local/Cellar/r/3.5.2_2/lib/R/library/base' to '/Users/werner/Documents/Projects/foo-data-analysis/data-analyze/rscript/packrat/lib-R/x86_64-apple-darwin17.7.0/3.5.2/base', reason 'File exists
And of course these files already exist:
➜ ll lib-R/x86_64-apple-darwin17.7.0/3.5.2/
total 0
lrwxr-xr-x 1 werner staff 50 Jan 4 16:09 KernSmooth -> /usr/local/Cellar/r/3.5.2/lib/R/library/KernSmooth
lrwxr-xr-x 1 werner staff 44 Jan 4 16:09 MASS -> /usr/local/Cellar/r/3.5.2/lib/R/library/MASS
lrwxr-xr-x 1 werner staff 46 Jan 4 16:09 Matrix -> /usr/local/Cellar/r/3.5.2/lib/R/library/Matrix
lrwxr-xr-x 1 werner staff 44 Jan 4 16:09 base -> /usr/local/Cellar/r/3.5.2/lib/R/library/base
...
They point to the old R library.
Expected behavior
My understanding is that these symlinks should always point to the actual system library, which is correctly printed in .libPaths():
I am using R 3.5.2_2 under macOS, installed via Homebrew with Packrat 0.5.0.
When Homebrew upgrades R to a new version, a new library is created, living in
/usr/local/Cellar/r/3.5.2_2/lib/R/library
, in contrast to the previous one at/usr/local/Cellar/r/3.5.2/lib/R/library
.Issue
When opening a Packrat project that I previously created with an old version of R, I get this error:
And of course these files already exist:
They point to the old R library.
Expected behavior
My understanding is that these symlinks should always point to the actual system library, which is correctly printed in
.libPaths()
:Possible workaround
I can
rm -rf lib-R
and restart R, then the symlinks will be recreated.