I am trying to install RGtk2. I have installed GTK+ and XQuartz with Homebrew:

$ brew cask install xquartz 
Warning: A Cask for xquartz is already installed. Add the "--force" option to force re-install.
$ brew install gtk
Warning: gtk+-2.24.28_2 already installed

But when I try installing it I get the error

Rgtk.c:7:10: fatal error: 'gdk/gdkx.h' file not found

Have I missed installing some necessary package?

1 Answer 1


Seems like a problem with RGtk2 which does not support Quartz GTK on OS X (and provided by Homebrew). I followed the advice posted here:


Which suggests installing the binary version:

install.packages("RGtk2", dependencies = T, type = 'mac.binary.mavericks')
  • I just had the same problem and your answer helped. The funny thing, though, is that your link was to an issue that I opened back in August. Guess I forgot what I learned! Ha! Thanks again.
    – Steve S
    Dec 28, 2015 at 21:23
  • This does not work on macOS Sierra: package ‘RGtk2’ is not available (as a binary package for R version 3.4.0)
    – shrgm
    May 11, 2017 at 18:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .