Jon K
Jon K

Reputation: 51

Conflicts between MacOS High Sierra and R packages

I am running MacOS 10.13 (High Sierra) and recently updated to R version 3.4.3 and R studio version 1.1.419. For some reason the rJava package is not working...tried several fixes from here on stackoverflow and nothing works. Also, the digest package will not load so I can no longer use ggplot2. Any suggestions?

Error for Java:

    > library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
  Reason: image not found

Error for digest package:

    > library("rJava", lib.loc="/Library/Frameworks/R.framework/Versions/3.4/Resources/library")
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: @rpath/libjvm.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/libs/rJava.so
  Reason: image not found

Upvotes: 2

Views: 1074

Answers (2)

John M
John M

Reputation: 1134

I don't know about the problem with rJava, but digest was just updated so if you try to install the binary it may not compiled and built yet. If that ever happens (it's somewhat of a race condition/lag), you can try to reinstall form source:

install.packages("digest", type = "source")

Upvotes: 0

Grace Mahoney
Grace Mahoney

Reputation: 505

New Mac OSX releases have a documented problem of messing up the Java path in R/RStudio (see here). It looks as though that this is what you're encountering here.

If you check out the question I've linked above, hopefully you can find a solution that works to reset your path; both of the commands below worked for me.

dyn.load('/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/server/libjvm.dylib')

or

sudo ln -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib

Upvotes: 1

Related Questions