How can I get gdk-x11-3.0 on OS X?

Short answer

I think the problem here is that a lot of homebrew packages don't include X11 support by default if there is a more relevant (i.e. OS X specific) backend available. But PDFPC is looking for the X11 backend for GDK.

Long answer

GDK is distributed as part of GTK+ and if you look at the formula for GTK+3 it explicitly disables the X11 backend.

args = %W[
  --disable-debug
  --disable-dependency-tracking
  --prefix=#{prefix}
  --disable-glibtest
  --enable-introspection=yes
  --disable-schemas-compile
  --enable-quartz-backend
  --disable-x11-backend
]

You could edit the formula to include the x11 backend and then run brew install --build-from-source --verbose gtk+3, but then the build fails before it even gets to the compile stage.

configure: error: Package requirements (atk atk-bridge-2.0) were not met:

No package 'atk-bridge-2.0' found

So you can then add `depends_on "at-spi2-atk" to the GTK+3 formula to get homebrew to install that package, and now GTK+3 gets through the configure stage and starts build. Unfortunately it then fails with errors because by default Cairo isn't installed with the X11 backend.

In file included from gdkapplaunchcontext-x11.c:27:
../../gdk/x11/gdkprivate-x11.h:46:10: fatal errorIn file included from gdkdevice-core-x11.c:In file included from 26gdkasync.c::
47:
../../gdk/x11/gdkprivate-x11.h:../../gdk/x11/gdkprivate-x11.h46::4610::10 :fatal error : fatal error'cairo-xlib.h' file not found
In file included from gdkcursor-x11.c:33:
../../gdk/x11/gdkprivate-x11.h:46:10: fatal error: 'cairo-xlib.h' file not found
#include <cairo-xlib.h>
         ^
#include <cairo-xlib.h>
         ^
: 'cairo-xlib.h' file not found
#include <cairo-xlib.h>
         ^
: 'cairo-xlib.h' file not found
#include <cairo-xlib.h>
         ^
1 error1 error generated.
1 error generated.

So then you can remove cairo and reinstall it with the X11 backend option.

brew remove cairo
brew install --with-x11 cairo

But now it fails with problems in libepoxy.

In file included from gdkdisplay-x11.c:40:
./gdkglcontext-x11.h:28:10: fatal error: 'epoxy/glx.h' file not found
#include <epoxy/glx.h>
         ^
  CC       gdkglcontext-x11.lo
1 error generated.
make[3]: *** [gdkdisplay-x11.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
In file included from gdkglcontext-x11.c:23:
./gdkglcontext-x11.h:28:10: fatal error: 'epoxy/glx.h' file not found
#include <epoxy/glx.h>
         ^
1 error generated.
make[3]: *** [gdkglcontext-x11.lo] Error 1
make[2]: *** [install-recursive] Error 1
make[1]: *** [install] Error 2
make: *** [install-recursive] Error 1

This is because the author of libepoxy dropped support for GLX on OS X back a few months ago.

Another big change is that OSX drops GLX support. I had had near-universal complaints about including it, and its seems like X on OSX is really not used these days (The lack of activity on its X server makes that pretty obvious).

And this is where I throw in the towel. :)


As stated in the README, cmake without movie support should do the trick.

cmake -DMOVIES=OFF

Works for me on macOS 10.12 (Sierra).

See also this issue.