2

Hi guys I tried to install this package in R but i can't load it.

install.packages("gmm")
library(gmm)

Apparently the installation is successful but when I try to load it an error occurs

Error: package or namespace load failed for ‘gmm’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so, 6): Library not loaded: /usr/local/gfortran/lib/libgomp.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/gmm/libs/gmm.so
  Reason: image not found

I am using a macOS with BigSur version 11.0.1 and the R version is 4.1.0 also R Studio version is 1.4.1106

I don't know how to solve this problem
Hope anyone can help me

Cristian
  • 71
  • 8

1 Answers1

2

I solved the problem by downloading "gfortran-10.2-Catalina.dmg" from this website https://github.com/fxcoudert/gfortran-for-macOS/releases which was suggested in the comments.
Although my mac version is BigSur, the Catalina file worked well.

Thanks to @BenBolker for helping me

Cristian
  • 71
  • 8
  • I solved the same problem by installing the whole gcc with brew and then creating a symbolic link to the needed file: 1. `brew install gcc`; 2. `sudo ln -s /usr/local/Cellar/gcc/13.1.0/lib/gcc/13/libgomp.1.dylib /usr/local/gfortran/lib/`. The principle of using that symbolic link I learned from [here](https://support.bioconductor.org/p/p134087/). – jaggedjava May 26 '23 at 19:27