In a former post I showed how Gnuplot 4.2.6 could be easily installed on Mac OS X. In the meantime Gnuplot 4.4.0 was released and although the wxWidgets terminal still doesn’t work on Mac OS X, there are the new cairo based terminals which provide png and pdf output. These terminals replace the gd terminals (libgd is not easily installed due it’s dependencies) and the old pdf terminal (which depends on the not-very-free pdflib). Since gif and jpeg (libgd terminal) shouldn’t be used for plots anyways, this is no loss. Since these formats are the ones which I need mainly, I show in this post how we could compile and install Gnuplot with little effort, providing X11, png and pdf terminal (and others which are compiled in anyway).
First we need to download and install the GTK Framework, which was described in this post. Basically you need to:
- Download the GTK_2.18.5-X11.pkg package from http://r.research.att.com/ and install it
- Add to your .profile file in the home directory:
- (Re)start Terminal.app and see if
pkg-config cairo --libsworks.
Then download Gnuplot 4.4.0, untar, configure and compile it:
- Download Gnuplot 4.4.0 from Sourceforge.
tar xzf gnuplot-4.4.0.tar.gz
mkdir build && cd build
../configure --with-readline=bsd --disable-wxwidgetsIn the configure output you should find something like
wxt terminal: no (requires C++, wxWidgets>2.6, cairo>0.9, pango>1.10) cairo-based pdf and png terminals: yes
sudo make install
Gnuplot will be installed in /usr/local/bin and should be ready to be used (if /usr/local/bin is in your path). pngcairo and pdfcairo are the new terminals you can use now. Gnuplot 4.4 has some major improvements so it may worth to install Gnuplot following these instructions.