Unable to load packages: libcairo.2.dylib not loaded

I have installed different packages but they all fail to load in library(). This is the latest message I received after trying to load the package gdtools. Would have any good solutions for this?

library(gdtools)
Error: package or namespace load failed for ‘gdtools’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so, 6): Library not loaded: /opt/X11/lib/libcairo.2.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.5/Resources/library/gdtools/libs/gdtools.so
  Reason: image not found

Does all your packages complain about this?
Library not loaded: /opt/X11/lib/libcairo.2.dylib

Do you have package Cairo installed? Also, on which operating system are you?

If you are on MAC OS try installing xquartz
https://www.xquartz.org/

3 Likes

Hi andresrcs,

Thank you! I downloaded XQuartz and it is working now. It is probably because I am working on Mac OS.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.