gnuplot on Mac OSX

# What is it?

gnuplot is a widely used scientific plotting program from the unix world that is free and open source. It can produce most of the types of plots that a scientist might require on a dazzling array of output devices.

# gnuplot News

2015-05-11 Caca terminal
A dumb terminal that’s not so dumb.
2015-05-08 Gnuplot 5: the Book
Now available for pre-order. Save over 60% and get preview chapters!
2015-01-10 xkcd in gnuplot
How to make gnuplot create graphs in the style of xkcd.
2014-06-16 How to Make a Cube Plot with Gnuplot
Another example that shows how you can make gnuplot do anything.
2014-02-25 gnuplot 4.6.5 Released
A handful of significant bugfixes and several interesting new features, including a new terminal and new smoothing modes.
2014-02-23 Arrow with T-shaped head in gnuplot
“For the measurement of distances T-shaped arrows are often used to highlight the length. In gnuplot there is an easy way to achieve this.”
2013-04-09 F# Wrapper for gnuplot
Control gnuplot with the F# language.
2013-03-21 gnuplot 4.7.0 for Ubuntu
Matt Joyce has packaged a development version of gnuplot in a PPA for Ubuntu. I haven’t tried it myself, and know nothing further.
2013-03-18 gnuplot 4.6.2 Released
Many improvements and bug fixes to make gnuplot more convenient, including better 3D plots using pm3d.
2013-01-10 gnuplot in the Browser
gnuplot compiled to javascript — surprisingly fast.
2012-10-04 Autocomplete in Gnuplot on Ubuntu
If you’ve installed gnuplot from the Ubuntu repositories and filename autocompletion is not working, try this.
2012-08-13 Airy Function in gnuplot Not Critically Accurate
If your use of gnuplot involves dealing with its implementation of the Airy function, read this.
2012-07-30 Problem installing gnuplot with MacPorts
If, after upgrading to Mountain Lion, installing gnuplot through MacPorts fails when building AquaTerm, check this page for a possible (and unexpected) solution.
2012-07-18 The gnuplot Contest is a Rapidly Fading Memory
The gnuplot Cookbook contest has ended and the three winners will soon receive their free books. Thank you to everyone who entered and especially for your interesting comments. Stay tuned — there may be another contest later in the year.
2012-07-16 Recreating Gnuplot within Minecraft
Not much to do with gnuplot per se, but undeniably wild.
2012-07-13 gnuplot Cookbook: Contest Ends Today
Just leave a comment to enter the contest for a free copy of my guide to gnuplot.
It’s been a crazy week in the Mid-Atlantic. I’m extending the deadline: you have one more week to get your comments in to win a free copy of the gnuplot Cookbook.
2012-06-22 Win a Free Copy of My gnuplot Cookbook
Be one of the three lucky winners!
2012-05-15 Demo of gnuplot patch supporting hypertext
gnuplot continues to grow towards the web. This patch, by one of gnuplot’s developers, is in the CVS version and may make it into a release one day. It allows labels to appear upon pointer-hover in SVG and HTML Canvas plots.

# The Two Types

## Self-contained

There are two main forms of gnuplot available for the Mac. There is a self-contained Carbon binary that may be your only choice if you are running a classic (pre-OS X) Macintosh system. This also runs on (at least some versions of) OS X, and may be convenient if you just need to see the output of a gnuplot command file, for instance, but don't need a permanent installation. This does not require X-Windows or any external viewer, and is easy to install, but it's not as good for external control (from gnuplot-py, etc.) as the standard gnuplot. However, this version has some unique features:

“gnuplot for Macintosh supports of number of Mac-specific technologies. In particular, gnuplot is AppleScriptable and recordable, supports PICT and QuickTime movie formats, incorporates a built-in gnuplot command file editor, and is drag-and-drop savvy. [....] it will run only on Mac OS 8.6 and above, must have Color Quickdraw, QuickTime, and CarbonLib 1.1 or above. The application has been tested under MacOS 9.0, MacOS 9.1, and MacOS X”

I recommend installing the traditional unix gnuplot for serious use on OSX. Since OSX is a unix system, any unix program that was written to be reasonably portable can be compiled to run on it. This includes programs such as gnuplot that, on traditional unix systems, produced graphical output with the X Window System, by installing a version of the X Window System on the Mac (or using the one that may be built-in). However, some graphical unix programs can be made to work with OSX's native display system (Aqua); gnuplot is one of these.

### Recent Macintoshes

Compiling gnuplot to run on recent versions of OS X can be a problem, as Apple ships their system with various broken or outdated libraries. Your best bet may be either to use MacPorts, which is reported to work with OS X 10.7.x, or to install the binary Octave package, which includes a binary of gnuplot. To get this to work on OS X 10.7.3 or later, apply the fix described on that page. Octave is a very nice system that you might want to have anyway.

Another source for a slightly older binary of gnuplot is Maxima, the excellent open-source symbolic algebra system. Maxima has plotting built-in using gnuplot; binaries for OS X contain gnuplot binaries.

### PPC Macintoshes and early OS X versions

The official gnuplot v. 4.0 sources compile without modification on OS X, and there is also a binary available here for PPC macintoshes. This binary works on Intel Macintoshes as well, but sometimes refuses to run on recent installations. To get it to work, try the fixes described in the comments. It works with X11 or AquaTerm, and in fact requires the latter to be installed. The readme document that comes with the binary download claims that it will not run unless X11 is also installed, but this is not true; fortunately you can run this gnuplot without needing to install X Windows.

I suggest you read up on the new features in v.4.0, a major upgrade. One significant enhancement is the incorporation of the pm3d splot mode, which has been an unofficial part of gnuplot for some time. This lets you plot color-mapped surfaces.

You can get Aquaterm sources and binaries (which can be used with more than just gnuplot), here. This has also undergone a major revision, so if you have a version < 1.0 you should upgrade.

# Testing

The new version of Aquaterm seems to be faster than previous ones, so I've been using this now for moderately large 3d plots, which I had been doing with x11. You do get some mouse control with the x11 terminal, however, that you do not get with Aquaterm: you can rotate and scale 3d plots, and annotate and zoom 2d plots. To get a summary of interactive controls on your console, type “h” when the plot window has focus.

▶  Comment   ∷     ◀

Markian Hlynka reported that he was able to make a binary from the sources (that used to be) here, and that it works with Apple's current (2/21/03) X11 download.

Through his work he also discovered the need to include gnuplot_x11, and contributed other corrections to this page. Thanks!

From: Chuck Sindelar

Hi, thanks for your WONDERFUL binary of gnuplot for OS X... I downloaded it and it works great with my X11 from Apple (I tried running the Aquaterm, setting "term" to "aqua" in gnuplot, and it didn't "just work", i.e. no plot windows came up, but X11 is just fine for me)

Interesting - maybe I need to update it for more recent versions of Aquaterm. What version are you running?

My main suggestion is it would seem wonderful, and really easy, to include in your binary distribution the /usr/local/share/gnuplot.gih help file... I downloaded it separately myself, because I have found I can't really use gnuplot without it.

I'll consider this, or maybe including some pointers to documentation. I always just used the manuals on the web.

Thanks again for the work of distributing this binary!!

Chuck Sindela

LBNL postdoc

From: Chuck Sindelar

the version is v1.0.a2, and like I said I really didn't try very hard (like read the directions or anything). The X-window worked, though. thanks again,

Chuck

Hi,

The gnuplot binaries are present for download as a pax.Z file. Since OSX doesn't come with cpio, is it possible to get it in a native Mac format?

cheers

-Ragu

My OSX (Panther) does come with cpio, but you don't have to use it. Instructions for unpacking the archives are on my gnuplot page. Perhaps you followed a direct link to the binary from some other website? Instead of linking directly to the download they should have linked to this page.

From: Philipp Robbel

Subject: gnuplot and aquaterm problem Date: Tue, 20 Jul 2004

I just downloaded your gnuplot binary for mac osx (thank you!!!). Since I don't want to install a full fledged X11, I tried to go with the aquaterm solution. I have one problem so I would be very grateful for your help. Ok, here is what I did so far:

- I ran pax as root as you describe on your website.

- I deleted the /usr/local/libexec directory with gnuplot_x11 in it since I did not plan to install X11.

- I downloaded aquaterm from the source forge website and from all the files that came with the distribution, I only moved AquaTerm.app to /Applications (I was no root anymore when i did this).

- I created a ~/.gnuplot file consisting of "set terminal aqua"

- I ran gnuplot and typed "plot sin(x)"

While the command seems to get through, no AquaTerm window pops up :-). Do you maybe konw if i was missing anything? Maybe setting an environment variable that points to /Applications/AquaTerm.app?

I am a bit lost and I would be _very_ grateful for your help.

Thank you!

Best,

Philipp

From: Philipp Robbel

Subject: gnuplot and aquaterm solution (kinda) :) Date: Tue, 20 Jul 2004

Hi there again,

I did something really smart this time :) I went to the Applications folder and double clicked AquaTerm so that the program was already started up in the background. When I then ran gnuplot again and put "plot sin(x)" it works.

So the problem seems to be that gnuplot does not spawn a new instance of the AquaTerm application -- for me it only works if it is already running in the background.

Regards,

Philipp

OK - glad it works. On my machines aquaterm will start up when I give gnuplot a plot command if it's not already running - weird.

From: Philipp Robbel

Subject: Re: gnuplot and aquaterm solution (kinda) :) Date: Tue, 20 Jul 2004

Oh, it is 100% working now. I even restarted to confirm. Whenever I issue the plot command it does in fact spawn a new window.

It seems that I had to start aquaterm manually _once_. Now it's spawning and everything works fine. Maybe aquaterm does some initialization when you start it manually for the first time? No idea but as long as it works now.... :)

Best!

Philipp

From: Richard Schmidt

Subject: aquaterm and gnuplot Date: Wed, 28 Jul 2004

Lee,

I have just installed your binaries for gnuplot 4.0 on my PowerBook running 10.3.4. First, thanks for making the install easy and available. I have used gnuplot in X11 and with aquaterm before and have just installed it after a HD crash. All is well in X11. I downloaded the lastest aquaterm (1.0.a2) and I can get it to work but need to have aquaterm open (running) before I boot gnuplot in the terminal. Should gnuplot automatically open aquaterm for me? I also had to set the gnuterm environment variable manually in order for aqua to be set as the default terminal when I boot gnuplot. Do I not have something configured correctly? Thanks in advance for any help.

Richard Schmidt

See the comments from Philipp Robbel above, and my replies: that's all I know about having to have Aquaterm running! Does it start itself now that you've run it manually?

About having to tell gnuplot to use aquaterm: you have everything configured fine, most likely. This is normal: gnuplot doesn't know what terminal you want to use, so set the environment variable or just tell it "set term auqa n", where n is an optional number (that lets you control which Aquaterm window gets the plot).

From: Rob Frohne

Subject: Gnuplot.... Date: Tue, 21 Sep 2004

Hi Lee,

Thanks for putting the web page about Aquaterm and gnuplot on the web. I had it working in previous incarnations, but after updating everything in my fink archive (including gnuplot 3.8) I couldn't use Aquaterm anymore. With your binary for gnuplot 4, it works now again.

(Gnuplot was claiming I needed to update Aquaterm, but it seems that it needed to be updated instead.)

Thanks,

Rob

--

Rob Frohne, Ph.D., P.E.

E.F. Cross School of Engineering

Walla Walla College

From: Jiri Cech

Subject: Gnuplot for Mac Date: Wed, 15 Dec 2004

if I install gnuplot4.0 for mac it look like all works well but i do not see anything new in my application folder.

It is like a unix program: the binary is put in to /usr/local/bin, which is most probably on your path. Gnuplot is used from the command line just as in other unix systems. If you installed Aquaterm that goes in /Applications, and should start by itself when you issue a plot command if you have said "set term aqua" to gnuplot. If it does not start by itself then start it manually and try your plot command again (you may have to kill and restart gnuplot in this case).

Of course you can use x11 instead of Aquaterm.

I have found it most useful to add another layer on top of gnuplot rather than talking to it directly, using Gnuplot.py; other people write scripts in other languages.

Should I gave up and stick to something more graphical as xmgrace? Is there any origin replacement in the Mac/unix world???

I don't know about these, but I've been using gnuplot on OS X for all my graphing for a few years now.

From: Anthony Gray

Date: Tue, 18 Jan 2005 Subject: gnuplot and mac os x

Hi Lee...

First, thanks, of course. I know (I hope) you must get that a lot.

Next, this is probably obvious, but I seemed to need to restart my machine after upgrading to AquaTerm 1.0 b2 to get it to play nicely with gnuplot. Nothing in the upgrade for AquaTerm suggested this. Again, probably obvious.

[... later]

I am trying to compile gnuplot plus a couple of patches to enable histogram style stacked bar-chart support. [link added to list below]

[... and a bit later]

I downloaded new sources and new patches, paid close attention to permissions and such, recompiled, and it works. [...] I haven't done much with it yet, but so far the stacked bar-charts look pretty neat.

Wow, that's a great website - thank you for pointing that out. I think I might apply some of his patches myself. In the meantime, I'll add it to the list of links.

From: Thomas M. DeBoni

Subject: GNUPlot 4 under OS X Date: Fri, 4 Feb 2005

Hey, at the urging of a colleague, I just found your download site. I grabbed your install package and put it on my old, crusty, 400 MHz G4 system, which runs OS X 10.3.7. Just thought you'd like to know it installed in a snap and runs fine. I've done some preliminary animations with it, and it's responsive and looks good. Well done, and thanks very much for providing this useful utility for the community!

Thomas M. DeBoni

Lawrence Berkeley National Laboratory

Berkeley, CA

It works quite well on my crusty 450 MHz G4 work machine and my crustier 400 MHz G3 laptop at home, too. Glad it was of use to you, and make sure you have a recent Aquaterm if you are using that, as they made significant improvements a few months ago.

From: Thomas DeBoni

Good advice about Aquaterm, thanks! Are there any plans to include the help package with this version of GNUPLOT?

I should look in to that; you are the second person who has suggested it.

From: Thomas M. DeBoni

It's no great big deal; I can use the help package on another (linux) machine. Interestingly, a run of "test" on both that system and my mac, show that your version of gnuplot, coupled with AquaTerm, is more capable than the linux version, coupled with X11. Well done!

That's interesting; in the past I've noticed that x11 was faster for big 2d (contour, map) plots, but maybe the newer Aquaterm is faster. It certainly renders image maps (like those made with pm3d splot mode) better.

Thanks for your kind words, but all I do is compile the official sources on OS X. Aquaterm support is even built in now, so I don't need to edit the sources to get that (just install the Aquaterm library files before compling). I offer the binary to help people who don't have the developer tools installed or have had trouble finding the right sources or getting them to compile.

From: Del Marshall

Subject: gnuplot carbon Date: Fri, 11 Feb 2005

From: Carl Witthoft

Subject: gnuplot carbon found Date: Sat, 12 Feb 2005

Hi -- dunno if this is old news, but your web page asked for links to gnuplot carbon.

regards,

Carl

From: Byron Q. Desnoyers Winmill

I've always liked the Carbon port of gnuplot and tracked it down: [see page text for links]

It is 3.7.1d

Byron.

Wow, three messages in three days pointing to locations for downloading the Carbon gnuplot! Using the information you provided as starting points, I'll try to maintain updated link information for the self-contained Carbon version.

From: Ryan Janzen

Date: Wed, 14 Feb 2007

Subject: [Gnuplot & Aquaterm] - Library Fix: 1.0.0 -> 1.0.1

Hello Lee Phillips,
I stumbled across your Aquaterm and Gnuplot website and downloaded the linked files. The latest version of Aquaterm is 1.0.1, whereas gnuplot is expecting 1.0.0. It is looking for /usr/local/lib/ libaquaterm.1.0.0.dylib but what Aquaterm installs is /usr/local/lib/ libaquaterm.1.0.1.dylib. A possible solution is to "sudo ln -s /usr/ local/lib/libaquaterm.1.0.1.dylib /usr/local/lib/libaquaterm. 1.0.0.dylib". It would be helpful to others if this is mentioned on your website. Other than that minor issue, it was very helpful.
Thank You,
Ryan Janzen
Thanks for your note; I think it will be helpful to others so I'll include it on the page. I guess since Aquaterm is officially supported by gnuplot now that the versions will get back in sync eventually, but you might want to mention this problem to the gnuplot maintainers.
Date: Wed, 12 Sep 2007
Subject: Gnuplot for MacOSX
Hello Lee,

I've been trying to install the latest gnuplot onto my Macs and am having problems. In the README.1st file, it says to copy the relevant makefile from config to src and the run the makefile in the src directory. Under the config directory, there's a MacOSX directory, and that ReadMe.rtf says that there is a gnuplot.pkg file to install. But, this file doesn't seem to be included in the download.

Karen Edwards
Hi,

I downloaded the 4.2.2 source package that you tried and you are right, there is no pkg file, but the reference to that seems to be an error in packaging; normally the pkg file is an installer that would come with a binary distribution, not a source distribution. To compile these sources you would follow the instructions for a unix platform (since OS X is unix). This will only work if you have Apple's Developer Tools installed, which includes the compiler. You type "./configure" in the gnuplot-4.2.2 directory, then "make", then, as root, "make install", usually. However, the compilation failed on my Mac just now; I'll have to figure out how to fix that some time later, when I have more time.

So if you really need version 4.2.2 I can't help you right now. However, you can get version 4.0, which I have and works fine. You can either download and compile the sources or, the easier route, just download the binary installer from the same download page:

http://sourceforge.net/project/showfiles.php?group_id=2055&package_id=1996

Just click the links for older releases until you see Gnuplot-4.0.0.dmg, download, and run the installer in the disk image. You will need Aquaterm, too, to run this gnuplot.

I hope this helps; let me know if there are any more problems.

From: Markian Hlynka

Date: Mon, 14 Jul 2008

Hi, Lee. I've been trying to install gnuplot on my new macbook pro. On 10.5 it doesn't seem to work. ie, the make fails. I believe I have found a solution here:
http://objectmix.com/graphics/344754-source-compilation-mac-os-x-10-5-leopard.html
However, I don't know what the ramifications are of doing: ./configure --with-readline=builtin. And I also don't know whether anything bad would happen with the first option, replacing libreadline. Since there were no instructions, I went with the second one.

Dear Markian,

Good to hear from you again. I don't have 10.5 installed, so have not yet tried to compile gnuplot on it. The official binary for PPC Macintosh, which is buried on the sourceforge page in the files for gnuplot v. 4.0.0, (it's the only .dmg download), is intended for PPC, but it still works fine on my current office Mac, which is an Intel running OS X 10.4.11. The download link is
I don't know if this will work under OS X 10.5 with Apple's messed-up readline. Has anyone out there run this binary under OS X 10.5?

From: Bob Wonderly

Date: Sat, 29 Nov 2008

Subject: gnuplot on Mac OS X

Lee

Thanks to your web site info re gnuplot and comments by others I managed to install (and get it to work) gnuplot 4.2.4 on my Mac Book Pro running OS X 10.5.5 (all this on November 29, 2008).

Then I ran:

 ./configure --without-readline make sudo make install

Maybe this info can be of help to others.

From: Stefano Covino

Date: Sun, 25 Jan 2009

Subject: problems compilng gnuplot under mac osx 10.5.5

[Mr. Covino had problems compiling gnuplot, so I suggested he use the official OS X binary. It didn't work either on his system:]

I tried, but apparently this does not work as well.

This is the output:

 [nexus:~] covino% gnuplot dyld: Library not loaded: /usr/local/lib/libaquaterm.1.0.0.dylib Referenced from: /usr/local/bin/gnuplot Reason: image not found Trace/BPT trap

try going into /usr/local/lib and looking at the files starting with "libaquaterm". The problem is likely to be that there is a symbolic link there that points to a nonexistent file, or that there is no libaquaterm.1.0.0.dylib. The relevant files in my /usr/local/lib are:

 libaquaterm.1.0.0.dylib -> libaquaterm.1.0.1.dylib libaquaterm.1.0.1.dylib -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm libaquaterm.dylib -> /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm

From: Stefano Covino

Date: Mon, 26 Jan 2009

Subject: problems compilng gnuplot under mac osx 10.5.5

It works!

Now it is clear whay happened. I installed aquaterm v. 1.0.1 (I guess), but the binary look for v. 1.0.0. It was enough to create a symbolic link and everything seems to work fine.

Thank you a lot Lee. Perhaps it could be good to add the few lines you sent to me in the web page too.

Cheers,
Stefano

From: Karl Ihrig

Subject: zoom out in gnuplot command p

Date: Sun, 17 Jan 2010

Hi Lee,
Command-P zooms out in Gnuplot.
Karl

Thanks, Karl. I've figured out the interactive controls and updated the relevant paragraph.

Date: Sun, 22 Jul 2012

From: Joseph

Dr. Phillips,

I recently purchased your Gnuplot cookbook, just a few minutes ago actually, because I noticed that, among other things, it describes using Gnuplot with LaTeX. [...]

Thanks for your email. I hope you find my book useful; I have several examples of different ways to get gnuplot and LaTeX to work together.

So far, the only way that I've been able to get a plot from Gnuplot into a LaTeX document is by making it a .png from the png terminal, or an .eps from the postscript terminal, and using \includegraphics in my .tex file.

That works, of course, but does not get you the very best possible results.

I have not been able to get the .tex files made by the epslatex, latex, and pslatex terminals to typeset in TeXShop.

The only one of those that you probably want to use is the epslatex terminal. To start, try setting the terminal in gnuplot as

set term epslatex standalone

and, before plotting, set your output file. Try using math in the labels or title, using LaTeX syntax (and doubling the backslashes), like

set title "$\\sum_a^b f(x)$"

Then process the output file that gnuplot creates in the usual way with pdflatex (or TeXShop). You should get a pdf with your plot and nice LaTeX labels. Look at the file to see how to include the plots in your own documents instead of using "standalone". Let me know if this doesn't work.

By the way, the following link on your website is dead - "LaTeX and the Gnuplot Plotting Program ? Using gnuplot with LaTeX: the latex terminal, EEPIC, and tikz with gnuplot 4.4"

Thanks for the tip.

Oh, and I've found the links on your website very useful, thank you!

You're welcome.

Lee

Links to products on Amazon earn me a small commission when you buy through them. Thank you for your support.