MacOS – How to use RSVG with ImageMagick

command linehomebrewmacos

I'd like to use the RSVG for SVG processing in ImageMagick (the included library is fairly incomplete). RSVG is a supported delegate but needs to be installed separately.

I've installed librsvg and its dependencies using Homebrew (no custom settings or anything like that). Running rsvg-convert manually works fine.

Installing ImageMagick with Homebrew doesn't auto-detect and use the RSVG library and running IM's configure script with --with-rsvg doesn't detect the library either.

Clearly something isn't talking to something else, but I can't make sense of the log messages well enough to sort it out. Any advice would be appreciated.

Here's the relevant portion of config.log:

configure:31587: checking for RSVG
configure:31594: $PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.9.0"
Package xcb-shm was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-shm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcb-shm', required by 'cairo', not found
configure:31597: $? = 1
configure:31610: $PKG_CONFIG --exists --print-errors "librsvg-2.0 >= 2.9.0"
Package xcb-shm was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-shm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcb-shm', required by 'cairo', not found
configure:31613: $? = 1

configure:31640: result: no
configure:31652: result: 

Best Answer

This message indicates that cairo, a prerequisite for librsvg, cannot find the configuration options for package xcb-shm. They should be stored in /opt/X11/lib/pkgconfig/xcb-shm.pc. All you have to do is add this path to the environment variable $PKG_CONFIG_PATH:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/X11/lib/pkgconfig

configure should now be able to find what it is looking for.