install R with cairo in macOS Mojave

When I install R-devel version in macOS Mojave, I always got

Capabilities skipped:        cairo

I tried to install the cairo and pango by brew

brew install cairo pango

But it does not work at all.

I opened cairo.m4 in the m4 folder and found that “whether cairo including pango is >= 1.2 and works” is checked by source

#include <pango/pango.h>
#include <pango/pangocairo.h>
#include <cairo-xlib.h>
#if CAIRO_VERSION < 10200
#error cairo version >= 1.2 required
int main(void) {
cairo_t *CC = NULL; // silence picky compilers
cairo_arc(CC, 0.0, 0.0, 1.0, 0.0, 6.28);
return 0;

When I compile it by gcc I got link error:

fatal error: ‘cairo-xlib.h’ file not found

And because brew install dropped all the –with options, I can not install cairo with xlib. Then I decide to install cairo from source.

And I configure the cairo by

./configure --enable-tee --enable-xml --enable-quartz-image

And then reinstall pango from source by ./configure && make && make install.

After that go to R-devel folder and reconfigure again:

./configure  --enable-R-framework

I finally got

R is now configured for x86_64-apple-darwin18.2.0

  Source directory:            .

  Installation directory:      /Library/Frameworks

  C compiler:                  gcc  -I/usr/local/opt/openssl/include -I/usr/local/opt/zlib/include

  Fortran fixed-form compiler: gfortran  -g -O2

  Default C++ compiler:        g++ -std=gnu++11  -g -O2

  C++98 compiler:              g++ -std=gnu++98  -g -O2

  C++11 compiler:              g++ -std=gnu++11  -g -O2

  C++14 compiler:              g++ -std=gnu++14  -g -O2

  C++17 compiler:              g++ -std=gnu++17  -g -O2

  Fortran free-form compiler:  gfortran  -g -O2

  Obj-C compiler:       gcc -g -O2 -fobjc-exceptions

  Interfaces supported:        X11, aqua, tcltk

  External libraries:          readline, curl

  Additional capabilities:     PNG, JPEG, TIFF, NLS, cairo, ICU

  Options enabled:             framework, shared BLAS, R profiling

  Capabilities skipped:        

  Options not enabled:         memory profiling

  Recommended packages:        yes


After make install, try following code to test in R:






电子邮件地址不会被公开。 必填项已用*标注