Install Gnuplot on Mac OS X

Posted September 16th @ 3:12 by Werner

I provide another instructions to install Gnuplot 4.4.0 compiling it yourself on Mac OS X.

There are some possibilities to install Gnuplot on Mac OS X, none of them is “official”, since the Gnuplot project doesn’t provide binaries for Mac OS X. It’s actually quite easy to configure and compile Gnuplot (i.e. ./configure; make; make install), but some terminals are not built due to missing dependencies and this makes Gnuplot less powerful.

There is some information on the web about running Gnuplot on Mac OS X already (http://lee-phillips.org/info/Macintosh/gnuplot.html , http://maba.wordpress.com/2006/08/02/scientific-plotting-on-mac-os-x-using-gnuplot-and-plot/ ) and there is also http://www.finkproject.org/ and http://www.macports.org/ but there is IMO an easier way (though it still needs some work): there is a Gnuplot installer provided by Octave! Here are the instructions:

  • Download Octave for Mac OS X from the Octaveforge homepage (latest version at time of writing was 3.2.2).
  • Open the downloaded dmg file and browse to the Extras folder
  • Open gnuplot-4.2.5-i386.dmg and copy Gnuplot.app to your Applications folder (or anywhere else).
  • Alternatively you could directly download the gnuplot-4.2.5-i386.dmg from here.

That’s about it. Or at least it should be. Usually you just open Gnuplot.app and start plotting. But unfortunately the default aquaterm terminal doesn’t work for me always (on one Mac it did, on another it didn’t – maybe Aquaterm shouldn’t be installed before). So we need to hack Gnuplot.app so that X11 (which is also more powerful) becomes the default terminal.

  • Right click on Gnuplot.app and choose “Show Package Contents”.
  • Browse to Contents/Resources and edit “script” with your favorite text editor
  • Replace both lines do script (“exec ‘${ROOT}/bin/gnuplot’”) with do script (“GNUTERM=x11 exec ‘${ROOT}/bin/gnuplot’”) . X11 will then be the default terminal.

You might also want to have gnuplot available in your usual terminal session. This is also no problem. Just run the following command in your terminal

ln -s /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot /Users/username/bin/gnuplot

where username is your user name. /Users/username/bin must be added to the path, so that Gnuplot works form everywhere, e.g. you could add the following to the /Users/username/.profile file

# add binary directory of .local
export PATH=$HOME/.local/bin:$PATH
# add bin directory of home directory
export PATH=$HOME/bin:$PATH

If you run gnuplot from the Terminal.app again the Aquaterm terminal is the default. This can be changed by adding

# use x11 as the default Gnuplot terminal
export GNUTERM=x11

to your .profile file.

3 Trackbacks/Pingbacks

  1. Pingback: Install Gnuplot 4.4.0 on Mac OS X | miscellaneous.debris on March 25, 2010
  2. Pingback: Install Gnuplot 4.4.0 on Ubuntu Linux | miscellaneous.debris on April 7, 2010
  3. Pingback: problems with E+ and gnuplot on OS X « Computational Design on March 17, 2012

6 Comments

  1. jsalvatier
    October 26, 2009 at 03:01

    Thanks for this! It turned about to be very useful.

  2. Rodolfo Canet
    November 12, 2009 at 13:00

    It does work! Thanks a lot, I had a virtualized copy of Linux just to use gnuplot, which was very cumbersome.

  3. Frederik
    December 3, 2009 at 02:09

    Wow, great help! This blog entry saved me quite some time ;-).

  4. rf
    October 14, 2010 at 22:06

    Very helpful. Thanks a lot. For me it worked at first but I had already installed Aquaterm.

  5. Alex Chan
    June 9, 2011 at 22:15

    Thanks a bunch; I needed Gnuplot to run Tikz in TeXShop, and thought I was going to have to install Xcode, Macports, and several other bits — this was much simpler, thanks!

  6. Mike
    July 17, 2013 at 15:43

    Thank you for such a concise and helpful tutorial!!

Leave a comment

OpenID Login

Standard Login

 

Options:

Size

Colors