rjags will not load on my Mac OSX Big Sur. The image shows up in my library when I check for it, and coda seems to be loading fine, but the image is "not found". I've tried reinstalling R and R studio, and using the devtools installation option as well. Here's the error message I get:
library(rjags)
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.0/Resources/library/rjags/libs/rjags.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rjags/libs/rjags.so, 10): Library not loaded: /usr/local/lib/libjags.4.dylib
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rjags/libs/rjags.so
Reason: image not found
Anonymous
I am having the same issue. Any chance this could be moved up in priority?
The rjags package is an interface to the JAGS library. You need to install separately rjags and an JAGS. Have you done this?
https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Mac%20OS%20X/
Very helpful, it worked for me. Thank you!
Sorry Martyn, I was attempting to use JAGS through the rjags interface using the new native ARM based R. This fails. I switched back to the standard R build, and I can get rjags running just fine. Installing rjags in ARM based R gives the following error:
checking for jags_version in -ljags... no
configure: error: "cannot link to JAGS library in /usr/local/lib."
ERROR: configuration failed for package ‘rjags’
I am unable to install rjags package in R. Mine is Mac OS
I have separately installed JAGS first and then installed rjags. After installation, the package does show in the packages list. But doesn't get loaded
library(rjags)
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/venkatpgi/Library/R/arm64/4.1/library/rjags/libs/rjags.so':
dlopen(/Users/venkatpgi/Library/R/arm64/4.1/library/rjags/libs/rjags.so, 10): Library not loaded: /opt/R/arm64/lib/libjags.4.dylib
Referenced from: /Users/venkatpgi/Library/R/arm64/4.1/library/rjags/libs/rjags.so
Reason: image not found
I can't really help with problems on Mac (assuming you have followed the instructions in my previous reply). Perhaps Matt @mdenwood can shed some light on this.
This issue is almost certainly due to an arm64 installation of R vs x86_64 installation of JAGS (the clue is that /opt/R/arm64/ is where CRAN install their build of JAGS on arm64 machines, but the official installer of JAGS is still x86_64 only and installs to /usr/local/).
I have only recently (i.e. 3 weeks ago) obtained an M1 mac and started experimenting with installation mechanisms. There are still some difficulties to resolve, including what to do about the mixture of /opt/R/arm64 and /usr/local installation paths that CRAN use for the rjags binary on arm64 vs x86_64, before I release a signed universal binary that should hopefully resolve these issues. In the meantime I have uploaded some provisional binaries as tarballs at: https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Mac%20OS%20X/extras/ - you can install the arm64 version using (from the Terminal):
(If the second command fails, then try it again with sudo)
I have been trying to collect together macOS installation issues via this thread, as they are typically nothing to do with JAGS itself and (these days) almost always due to incompatible binaries/architectures:
https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/07e08a3605/
Again, the situation is currently somewhat fluid, but I will post updates in that thread.
Matt