Unable to load package Cairo in my Rstudio

Hi, everybody,

I am having a problem loading the package Cairo. The errors are below with my sessioninfo.
Thank you for your help.

Error: package or namespace load failed for ‘Cairo’:
 .onLoad failed in loadNamespace() for 'Cairo', details: call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Cairo/libs/Cairo.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Cairo/libs/Cairo.so, 0x0006): Library not loaded: '/opt/X11/lib/libXrender.1.dylib'
  Referenced from: '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Cairo/libs/Cairo.so'
  Reason: tried: '/opt/X11/lib/libXrender.1.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libXrender.1.dylib' (no such file), '/Users/am/lib/libXrender.1.dylib' (no such file), '/usr/local/lib/libXrender.1.dylib' (no such file), '/usr/lib/libXrender.1.dylib' (no such file), '/lib/libXrender.1.dylib' (no such file), '/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre/lib/server/libXrender.1.dylib' (no

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] magick_2.7.3

loaded via a namespace (and not attached):
[1] compiler_4.2.1 magrittr_2.0.3 tools_4.2.1    Rcpp_1.0.9

Do you have XQuartz installed and up to date in your system?

Hi andresrcs, thanks for the answer.

No, have not installed it. Should I install it like below?

XQuartz is not an R package, it is an independent software that provides X11 capabilities for MacOS systems.


1 Like

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.