I have a M1 Macbook Pro running OS Big Sur and just tried to install rjags
and JAGS
. I downloaded JAGS from https://sourceforge.net/projects/mcmc-jags/ without a problem, and ran install_packages("rjags")
, but when I run library(rjags)
I get this error:
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so':
dlopen(/Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so, 10): Library not loaded: /opt/R/arm64/lib/libjags.4.dylib
Referenced from: /Users/afredston/Library/Caches/org.R-project.R/R/renv/cache/v5/R-4.1/aarch64-apple-darwin20/rjags/4-12/e8a71b3a154c8e68c152b4cfbebfdd97/rjags/libs/rjags.so
Reason: image not found
I understand this means that R cannot "find" the installation of JAGS. I am using renv
for this project, but even if I deactivate it and re-run install_packages("rjags")
and library(rjags)
I get the error (just with different file paths):
Loading required package: coda
Error: package or namespace load failed for ‘rjags’:
.onLoad failed in loadNamespace() for 'rjags', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so, 10): Library not loaded: /opt/R/arm64/lib/libjags.4.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rjags/libs/rjags.so
Reason: image not found
I'm a stats person without much back-end computer expertise so I'd appreciate help resolving this!