Install RGtk2 on macOS Sierra 10.12.6 and R Version 3.4.1

1.7k Views Asked by At

My ultimate goal is to install the rattle package in R, and to do that, I need to install the dependency RGtk2.

This question is similar to Installing RGtk2 on macOS Sierra (Version 10.12.4) and R version 3.4.0 But I have gtk installed. This question is similar to R In install.packages("RGtk2") : fatal error: 'gdk/gdkx.h' file not found but that question is still open, and I'm hoping someone can shine more light on this issue.

The error I'm having is below:

* installing to library ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library’
* installing *source* package ‘RGtk2’ ...
** package ‘RGtk2’ successfully unpacked and MD5 sums checked
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for INTROSPECTION... no
checking for GTK... yes
checking for GTHREAD... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out

...

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

I've seen a solution to force or ignore gdk/gdkx.h, but it seems fishy to me.

To install rattle, I've taken the following steps. Following this string, R 3.0 and GTK+ / RGTK2 error, I tried downloading Simon Urbanek's library from http://r.research.att.com/#other, using the GTK_2.24.17-X11.pkg but it didn't work.

From that same question, I also installed homebrew from brew.sh just by copying the command they give.

brew install gtk+
export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig:$PKG_CONFIG_PATH
R CMD INSTALL /Users/joshualamstein/Downloads/RGtk2_2.20.33.tar

Which lead to the results I have now, and my question. My ultimate goal is to install the rattle package in R, and to do that, I need to install the dependency RGtk2. Any help you have would be appreciated. Thank you!

1

There are 1 best solutions below

0
On BEST ANSWER

The solution posted by zhiyzou here worked for me with Sierra 10.12.6 and R 3.4.2: https://gist.github.com/zhiyzuo/a489ffdcc5da87f28f8589a55aa206dd

Then be sure to restart Rstudio, or launch through XQuartz.