Gas station without pumps

2012 January 2

Installing gnuplot—a nightmare

Filed under: Software — gasstationwithoutpumps @ 14:19
Tags: , , , , , , ,

My son and I use gnuplotfor all our graph plotting, because it is free, it has good curve-fitting tools, it can produce graphs in many standard graphical formats (both vector and raster formats), and it has good scripting capabilities.

Example of a simple gnuplot graph, click for full-size image.

I sure wish that it came already installed on Macintosh computers, though, as it is huge pain to install.  We had to install it for my son to do his latest physics lab writeup, as the old version we had on the household computer was from the old G5 iMac, and could not run under Lion, which no longer supports emulation of the PowerPC processors.

Probably the easiest way to install gnuplot is using MacPorts, so first we had to install MacPorts.  Downloading it went fine, but it wouldn’t install, because the Xcode that came with the Mac was not suitably configured.  So we had to install a new Xcode, which meant setting up an AppStore  account.  The Xcode download is almost 2 Gbytes and took an hour.  What the h*** is in Xcode that it is so bloated?  So far as I can see, Xcode contains a low-quality editor (about as powerful as Textedit), some compilers, and a build system that is about as featureful as make. The download is about 100× bigger than is reasonable—is it full of porn videos or what?

After the hour-long download of Xcode, MacPorts installed ok, but to run it we had to add /opt/local/bin and /opt/local/sbin to the path in the .cshrc file (and /opt/local/man to the MANPATH), since MacPorts puts its programs in a totally separate place form where everything else gets installed.

Because my son wanted to use the latest features of gnuplot (the pdfcairo output option), we started by using

sudo port install cairo
sudo port install pango

This triggered a huge pile of downloads and installations, as MacPorts built an entire ecosystem duplicating most of the compilation and building capabilities of Xcode (so why does it need Xcode to get started). After about an hour of downloads and building, we were finally ready to install gnuplot.

Due to lack of documentation for Mac installation on the gnuplot site, we downloaded and installed gd-libgd, which probably was not necessary, because

sudo port install gnuplot

installed a different version of gd anyway.  The total time to do the installation was over 2 hours (mostly due to the massive downloads).  It also took up a huge amount of disk space (1.9Gbytes for Xcode, 769Mbytes in /opt).  All that for a tiny program that is only about 2Mbytes. I just wanted one small graphing program, not two huge ecosystems for developing code!

There are two groups of people who could fix this problem:

  1. Apple could include gnuplot in their standard Unix utilities.  This would be the simplest and best solution.
  2. The gnuplot developers could release Macintosh binaries (like they already do for Windows) that install like other Macintosh programs.

I’m not going to hold my breath waiting for either of these things to happen.  Apple has no interest whatsoever in the scientific market (though I see more and more MacBooks at conferences) and the gnuplot developers see nothing wrong in taking 2 hours and 2.7Gbytes to install a 2Mbyte program—they do it all the time.

I used to recommend gnuplot to my students all the time, but now that most of them have Macs, I can’t honestly recommend it anymore.  No one should have to go through that much hassle to install a simple program.

[Added 2013 March 15: Read through all the comments.  Gnuplot installation on Macs has gotten somewhat easier since I wrote this post, and people have written about better approaches in the comments.  Installation is still not as easy as it should be, but it is not quite the nightmare it was.]

About these ads

35 Comments »

  1. I agree that no one should have to go through all that, and you don’t have to! I just use “sudo apt-get install gnuplot” and it is ready to use. Oh, of course you should be using a good operating system that has a proper package system, like Linux. Can’t you boot Linux under Mac?

    Or, alternatively, spend some volunteer time and energy and contribute back to an open source project and help them create a better download.

    Comment by Doug Blank — 2012 January 2 @ 17:16 | Reply

    • It is precisely the attitude that only Linux users deserve to have access to gnuplot (and that everyone else should install Linux in addition to whatever operating system they have) that makes me despair of gnuplot ever becoming popular.

      I use Linux systems at work, and getting the tech staff to keep gnuplot up to date is a pain there also, but in a different way (I’m not allowed to be root, so have to wait for tech staff to get around to doing installs, and every machine has a different version of the software, based on when the last update was done—I don’t believe that gnuplot is part of their standard install).

      Actually, at work I had to download and install gnuplot in a non-standard location myself, in order to be able to get new versions as needed, without 3-day turnaround. It wasn’t any more fun than doing it on the Mac, but at least I did not have to wait an hour for the unnecessary Xcode download.

      Comment by gasstationwithoutpumps — 2012 January 2 @ 18:16 | Reply

      • Linux users don’t “deserve” anything… but they often contribute back to the entire ecosystem and thus make it better. I’m a Linux user, and I pay for that in tracking down issues and reporting bugs (some would consider that a high price, but I feel I get back what I pay). Open source projects are also a good way to introduce students to how to track down problems and how to report them, and, for advanced students, they can even contribute code, documentation, and other helpful text, such as blogging. You should add that to your lists of recommendations for students rather than telling them to just avoid gnuplot. Or, if there is an easy way to run the entire Linux system inside Mac, then that would also be a good recommendation.

        Building gnuplot from scratch is also a hard way to go. But it is great that free and open software allows you that option, you didn’t have to buy anything, and you have the freedom to change the software in any way you like. Perhaps a three-day turnaround is not that onerous? Or perhaps there could be a way to fast-track specific requests? For example, I have “sudo” privileges for certain operations at work that allow me to install known packages.

        Open source software projects are largely made up of communities of people like you and me working toward the better good by volunteering their time and energy. This is an aspect (perhaps the most important aspect) of projects like gnuplot that you completely overlook.

        Comment by Doug Blank — 2012 January 3 @ 04:06 | Reply

        • I do contribute to open-source projects sometimes (see, for example, https://gasstationwithoutpumps.wordpress.com/2011/11/08/tracker-video-analysis-tool-fixes/ where I spent over a week developing and debugging an improved capability for the Tracker project). I also do bug reports (for example, reporting a PWM frequency bug in the Adafruit motor shield software).

          I do understand the open-source ecology, but the idea is not that everyone must contribute to every open-source project, nor that open-source is only for Linux, though that seems to have been the way that the gnuplot community has been going. Many other open-source communities take a little extra effort so that non-developers can also use their tools, but for years gnuplot has been made unnecessarily difficult to install, except for a relatively small circle of Linux users.

          Comment by gasstationwithoutpumps — 2012 January 3 @ 04:54 | Reply

          • Gnuplot is not “made unnecessarily difficult to install”. It is made to be a marvellous plotting tool for people like us to freely use, enjoy and modify it as we wish. It is unfortunate that it is difficult to install on Mac OS X, but there are apparently limits to the efforts that programmers and contributors to open source software are willing to go to, in order to make it easy for non-programmers to install.

            Let’s not lose sight of what’s so wonderful about Gnuplot because there’s some friction in installing it. Let’s also encourage developers to make it better and easier to install by telling them how much we love it, and how much we would like to see other people more easily enjoy it too.

            Comment by Dan — 2012 January 10 @ 06:19

  2. I have not found gnuplot to be difficult to install on Windows. One downloads a binary and clicks a few times. The same is true of other programs native to Unix such as Python.

    Comment by VR — 2012 January 6 @ 14:10 | Reply

  3. I agree that it would be great if the gnuplot devs simply provided Mac binaries/installers.

    However, I had a hunch that other FOSS Mac installers might include a nice binary of gnuplot. http://www.miscdebris.net/blog/2009/09/16/install-gnuplot-on-mac-os-x/ seems to bear that out. It’s dated, and I haven’t had time to try it yet, but thought I should point out this workaround/alternative for you and your students.

    Comment by RO — 2012 January 30 @ 07:01 | Reply

    • Thanks for the pointer. I wonder if the disk image in the Octave distribution plays nicely with Mac OS 10.6 (Lion). If so, then getting it from the Octave distribution has got to be better than the Xcode+MacPorts route, which installs gigabytes of garbage and takes forever.

      Comment by gasstationwithoutpumps — 2012 January 30 @ 11:54 | Reply

  4. [...] wanted to install it on our Macs, but like with our troubles with gnuplot, the developers of Asymptote have made it damn near impossible to install on Macs. We did find [...]

    Pingback by Asymptote drawing program—hard to install « Gas station without pumps — 2012 April 3 @ 13:43 | Reply

  5. [...] a good parameter fitting command, but I’ve given up recommending it to people, because of the extreme difficulty in installing it.  It is also overkill for a lot of high school classes, where fitting a straight line is [...]

    Pingback by LinReg for physics class data graphing « Gas station without pumps — 2012 May 29 @ 09:58 | Reply

  6. [...] Installing gnuplot—a nightmare [...]

    Pingback by Second Blogoversary « Gas station without pumps — 2012 June 2 @ 18:15 | Reply

  7. [...] need to know how to use a good model-fitting program.  Gnuplot is nice, but installing it will be too painful for those with Macs (unless the gnuplot community has finally gotten around to making a Mac installer that [...]

    Pingback by Conductivity of saline solution « Gas station without pumps — 2012 August 12 @ 01:18 | Reply

  8. Thanks a lot for your guide, man! I was wasting my time like hell to figure out how to get it run!!!! What a relief.
    Since I have got this Mac Pro Notebook with Retina display and I has the latest version of OSX, Mountain Lion 10.8.1 and I barely had linux administration skills before and I had to run my assignment with Mac and goddamn gnu plot, I couldn’t find an easy and step-by-step solution to it. To make your solution more clear for those who might encounter some other problems, I rewrite your solution in a plain language:

    1- Download gnuplot from (.tar.gz file for Mac OS) http://sourceforge.net/projects/gnuplot/files/gnuplot/4.6.0/gnuplot-4.6.0.tar.gz/download
    2- Unzip it where you can remember later.
    3- Download and Install XCode from AppStore (it needs a valid ID and Password though!) ~1.6 GB
    4- Install “Command Line Tools” from upper menu: “XCode > Preferences… > Downloads > Command Line Tools” ~140 MB
    5- Download and install “Macports” (a great package installer for free source softwares such as Fink, Homebrew and etc.) from https://distfiles.macports.org/MacPorts/MacPorts-2.1.2-10.8-MountainLion.pkg
    6- Go to your home by “cd ~”
    7- Create a file named .cshrc by typing “vim .cshrc”
    8- write down following lines exactly:
    /opt/local/bin
    /opt/local/sbin
    9- Type “:w” and hit enter to write these lines to the file and exit.
    Go to your folder where your gnuplot files are:
    10- Run “sudo port install cairo” (takes 10 minutes or more to download)
    11- Run “sudo port install pango”
    12- Now you should accept an Apple license for Xcode to let AquaTerm be installed by running “sudo xcodebuild -license”! (kinda Akward!)
    13- Run “sudo port install gnuplot”
    Now you are set to go!
    Run it as a batch or command line!!!

    Due to lack of management and too much freedom, OpenSource community is seldom able to provide a resolute answer to simple questions! It really sucks!

    Comment by Habib — 2012 September 11 @ 01:16 | Reply

    • I don’t think that your editing of the .cshrc file is correctly described, since what is required is adding the /opt/local/bin and /opt/local/sbin directories to the “path” variable (in the “set path” line, if there is one). One can edit the .cshrc file with any text editor—it doesn’t have to be vim—I use emacs, but TextWrangler would work also. TextEdit or XCode should work also, if you can figure out how to get them to open “hidden” files that start with a “.”.

      Comment by gasstationwithoutpumps — 2012 September 11 @ 05:23 | Reply

    • Nice summary. Worked perfectly other than the ‘path’ editing in step 8. I use csh ( does everyone?) and this works at the end of .cshrc

      set path=($path /opt/local/bin /opt/local/sbin)

      Comment by Sarah — 2012 September 21 @ 07:05 | Reply

  9. 1) There’s no need to criticise XCode because you don’t personally have a use for it. I can assure you it’s vastly more powerful than Textedit for those who need it.

    2) You don’t need to download XCode to do what you need to do. Instead, get a free developer account on apple.com, log in, and download their “command line tools.” This is about 150MB and includes all the essentials (gcc etc.)

    Comment by doesn't matter — 2012 September 13 @ 08:47 | Reply

    • I wasn’t criticizing XCode, merely complaining about the massive download needed to update it. I already had a version of XCode installed, but MacPorts was insisting that I needed to update it.

      Having to register as an Apple developer in order to install an end-user program is a ridiculous suggestion, though.

      Comment by gasstationwithoutpumps — 2012 September 13 @ 09:56 | Reply

  10. Anyway, thanks to you. It worked. I am a scientist used to Linux and heavy programming, but I also find geekiness useless and time-wasting. Simple cookbook recipes with clear to-do items are what we need to be productive thanks to the work of the open-source community! Open-source world will be also more promoted if made accessible to pedestrians!

    Comment by Demian — 2012 September 21 @ 00:23 | Reply

  11. I just installed from source and you don’t need to install Xcode completely to do so.
    You will need a apple developer account, they are free.
    go to the website

    developer.apple.com/downloads/

    1. download and install the Command line tools for Xcode. (no xcode installation necessary)
    2. download and install XQuartz (http://xquartz.macosforge.org/landing/)
    3. download the gnuplot source (http://gnuplot.info)
    4. using the terminal go to the directory where you placed the gnuplot.tar file and use the following commands:

    tar -xvf gnuplot.tar
    ./configure
    make
    sudo make install

    It worked for me without problems, I hope this helps.

    Comment by Chuy — 2012 September 25 @ 07:47 | Reply

    • That does reduce the problem to having to register for an Apple developer account, which could be a problem for some people, but probably less of one than installing MacPorts.

      Comment by gasstationwithoutpumps — 2012 September 25 @ 08:35 | Reply

  12. I don’t mean to say not to use gnuplot, I am trying to install it myself, however, have you ever checked the capabilities of Grapher?
    Grapher is in you utilities folder and it is a small pearl that it is normally underused and under appreciated.
    It has many capabilities including curve fitting and some programming.
    I assure you will be impressed

    Comment by David — 2012 November 8 @ 11:21 | Reply

  13. [...] Installing gnuplot—a nightmare [...]

    Pingback by 2012 in review « Gas station without pumps — 2012 December 31 @ 11:16 | Reply

  14. [...] with the gnuplot installation on that Mac was not solvable by the techniques in the comments for Installing gnuplot—a nightmare, because all the methods there assume that you can install the command-line tools [...]

    Pingback by Fourth day of circuits class « Gas station without pumps — 2013 January 14 @ 18:36 | Reply

    • I’ll pay $20 to anyone who posts a statically compiled binary of gnuplot with png support, as long as it runs on Mac OS X 10.8.2. If you post it, mail pkillelea@shutterfly.com to claim your reward. I do _not_ want something graphical that runs from the Apps directory. I want a statically compiled binary that runs from a terminal window when I type “gnuplot” there.

      I never understood the fascination with compiling from source when static binaries just run without any compile or install. They just download and run. Sure, I’ll have to trust you’re not doing anything too malicious, but it’s not like I’ll read all the source code anyway.

      Comment by Patrick Killelea — 2013 January 15 @ 16:25 | Reply

  15. I have installed gnuplot over the last ten years on a many machines, ranging from iBooks G3 running with Tiger to the latest MPB with ML. Yes, sometimes there are minor problems, but I never failed getting it installed. It is not that difficult at all, and I do not understand why people say this is a nightmare. I always install with MacPorts. Make sure that you have Xcode & Command Line Tools installed before you begin and follow the instructions on the MacPorts site. Also, make sure that you accept the Apple licence for Xcode to get Aquaterm installed. (See this: http://trac.macports.org/ticket/35337). The reason why gnuplot should be installed this way is that there are a number of dependencies between gnuplot and other binaries and libraries that are not part of the standard Mac OS. If you install gnuplot with MacPorts, all these important files will be build and copied to the proper places, along with gnuplot. Launching a precompiled gnuplot binary may result in crashes or disappointing behavior, because all these files are missing.
    And, really: Who cares today about 2GB on /opt when you have a 750 GB HD??
    Cheers,
    Peter

    Comment by Peter Appel — 2013 January 22 @ 13:18 | Reply

    • You may have noticed that I used MacPorts and that was part of the nightmare. I have only 89Gbytes left on my laptop, and they go quickly whenever I have to process a new set of photos or a new video—2Gbytes is quite a bit of the available space, and downloading that much takes a really long time.

      There are good reasons for doing static linking (rather than dynamic libraries) where there are a lot of dependencies. A good statically linked binary for Mac OS X machines would be very popular, and wouldn’t be anywhere near as big as the 2Gbyte environment that Peter prefers.

      Comment by gasstationwithoutpumps — 2013 January 22 @ 15:02 | Reply

  16. I’m very thankful !!! it’s work perfect, I spend to many month trying to install Gnuplot on my mac, your help is perfect and whit this it take me a few minute of my time

    Comment by Dany — 2013 February 3 @ 23:39 | Reply

  17. I have been using gnuplot since 1991, compiling it on MS-DOS and UNIX the first year I used it. Apple’s OS X Mountain Lion has two obstacles to installing gnuplot.
    1) Xcode has made command line tools optional (only make and gcc compiler are required to compile gnuplot.)
    http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
    2) Mountain Lion no longer has X11 as Snow Leopard did, you have to download X11 Quartz. http://support.apple.com/kb/HT5293

    Last night was the first time I installed gnuplot with Hombrew (after installing Xcode command line tools). I was able to install Homebrew and gnuplot with these semicolon separated commands and entering a password at the prompt: curl -fsSkL raw.github.com/mxcl/homebrew/go > hb.rb; ruby hb.rb; homebrew install gnuplot

    I don’t have much experience with Homebrew, but it installed gnuplot fine, and gnuplot worked to my liking after installing X11 Quartz. I like the X11 terminal for plotting because it doesn’t use anti-aliasing. OS X terminals give me fuzzy plots. I prefer the crispier X11 terminal.

    Comment by Karl — 2013 March 2 @ 10:14 | Reply

    • Try “homebrew install gnuplot” without Xcode. Homebew warned me that I didn’t have Xcode command line tools installed, and installing without Xcode command line tools is experimental. This could be the easiest install!

      curl -fsSkL raw.github.com/mxcl/homebrew/go > hb.rb; ruby hb.rb; homebrew install gnuplot

      Comment by Karl — 2013 March 2 @ 10:19 | Reply

  18. Thank you guys for the detailed discussion of an important topic. I agree, gnuplot is a kind of standard software and I do not understand, why it became so complicated to be installed on recent Mac OSs.
    I think, I have found a good compromise:
    I have installed gnuplot via Maxima ( http://sourceforge.net/projects/maxima/files/ ) — Thanks to the open source community!!! Yes, this is the ‘graphical’ App which you will find in the Applications folder. But it installs only what is necessary in a self-contained way.
    There might be a lot of arguments against this way of installation, but at least now my 10 year old son (who always launches his apps from launchpad) will find gnuplot to play with graphs.

    But as I also want to have the program available from terminal or from my own programs, I have linked the executable unix file, which is contained in the package, to /usr/bin:

    sudo ln -sf /Applications/Gnuplot.app/contents/Resources/bin/gnuplot /usr/bin

    That’s it! For the time being, it works fine and I am not aware of any drawback.

    Comment by Johannes Rödel — 2013 March 7 @ 06:30 | Reply

  19. [...] Installing gnuplot—a nightmare [...]

    Pingback by Post 1024 | Gas station without pumps — 2013 March 23 @ 19:58 | Reply

  20. […] Installing gnuplot—a nightmare […]

    Pingback by Blogoversary 3 | Gas station without pumps — 2013 June 1 @ 19:59 | Reply

  21. […] Installing gnuplot—a nightmare […]

    Pingback by 2013 in review | Gas station without pumps — 2013 December 31 @ 11:19 | Reply

  22. […] probably have to talk about installing gnuplot in lab on Tuesday, as I want to do hands-on gnuplot scripting in lecture on Wednesday. […]

    Pingback by Panicking about circuits class | Gas station without pumps — 2014 March 30 @ 22:08 | Reply

  23. […] students with Macs had not been able to get gnuplot installed before class.  I pointed them to the comment on my previous post. I hope they’ll be able to get it installed this evening.  (The students with Windows […]

    Pingback by Gnuplot demo | Gas station without pumps — 2014 April 2 @ 17:29 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 251 other followers

%d bloggers like this: