I've recently updated to R 4.0.2 and am having horrific issues with devtools installation. I am getting the following error:
# approach 1
install.packages("devtools")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/devtools_2.3.2.tgz'
Content type 'application/x-gzip' length 337605 bytes (329 KB)
==================================================
downloaded 329 KB
library(devtools)
Error: package or namespace load failed for ‘devtools’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so
Reason: image not found
# approach 2
install.packages("devtools", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/devtools_2.3.2.tar.gz'
Content type 'application/x-gzip' length 373387 bytes (364 KB)
==================================================
downloaded 364 KB
* installing *source* package ‘devtools’ ...
** package ‘devtools’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/9/libgomp.1.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/pkgload/libs/pkgload.so
Reason: image not found
Calls: <Anonymous> ... asNamespace -> loadNamespace -> library.dynam -> dyn.load
Execution halted
ERROR: lazy loading failed for package ‘devtools’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/_5/rq2_d4m14rj0c2vsh_8mbhgh0000gn/T/Rtmp3x5lzg/downloaded_packages’
This makes sense: I actually have gcc10 instead of gcc9, installed via homebrew:
ls /usr/local/opt/gcc/lib/gcc/
drwxr-xr-x 47 darya staff 1504 19 Aug 13:18 10
I am not sure why R is not seeing that more recent version of gcc? Moreover, astoundingly, Rcpp works (and I've tested it with the basic code in the documentation vignette, so it not only loads, but also actually works).
How do I fix this? Thanks in advance!!!