How to install gnuplot in Mac OS X lion


I just bought a macbook pro recently. The first thing that I need is to setup the latex environment to write. The tex installation is not hard to achieve, you can just search “mac os latex installation” in google, you will find the dmg file to install it. The problem is I need gnuplot to draw charts, but there is no mac os binary for the latest version. So i tried to compile it my self. It is not hard but need a little trick.

First, download the latest gnuplot source from here: http://sourceforge.net/projects/gnuplot/files/gnuplot/

and then unzip the download file. Before start to compile and install it you need to install the ReadLine lib for gnuplot. This is an issue for mac os, which is indicated in the INSTALL file of gnuplot. In this file, it mentions two ways to install the ReadLine lib, one is to override the mac os one, while another is install it in your personal space and specify the path to gnuplot installation.  I chose the second one.

To download the latest ReadLine lib source, click here: readline-6.2

Create a folder in any place you want to install readline lib (except /usr/local/), mine is /Users/bohoustudio/Local

unzip the lib downloaded and type the command in a console:

./configure  --prefix=<the path of the folder you just created>
make install

Usually you will have an error that use -dynamiclib rather than -dynamic

You need to go into the sub folder shlib in the ReadLine source folder and edit Makefile, search -dynamic and change it to -dynamiclib

Go to console type:

make clean
make install

The ReadLine lib is well installed.

Change your working directory to the gnuplot source folder, type

./configure --with-readline=<the path of the folder you just created>
make install

Your gnuplot for mac os is well installed now.

Advertisements

42 thoughts on “How to install gnuplot in Mac OS X lion

    1. I have a problem, don’t know how to start gnuplot after i’d fired up my terminal and typed : brew install gnuplot. Can you help me?

  1. Hmmm,
    gnuplot> set terminal aqua enhanced title “Figure 1”
    line 0: unknown or ambiguous terminal type;
    Any ideas anyone?

  2. Thanks for this post; currently the steps are:
    1. Download and install Xcode command line tools from Apple developer site.
    2. In “terminal” create “/usr/local” (this does not exist by default on MacOSX Lion, “makedir /usr/local”)
    3. In “terminal” run “sudo make install” (type in admin password for “sudo”)
    4. Run X11 (in Utilities) since gnuplot needs X11 to display graphs

    So it appears Apple fixed the readline problem? Gnuplot appears to be working now…

  3. I followed your suggestions step by step and got the following error…please advise :

    mkdir: /usr/local/libexec/gnuplot: Permission denied
    make[3]: *** [install-pkglibexecPROGRAMS] Error 1
    make[2]: *** [install-am] Error 2
    make[1]: *** [install-recursive] Error 1
    make: *** [install-recursive] Error 1

      1. Thanks bhou for your tutorial ! I’ve a question : I wonder if I need to have Xcode installed to execute the commans you indicate ?

        In deed, the first command returns to me this message :

        checking build system type… i386-apple-darwin12.2.0
        checking host system type… i386-apple-darwin12.2.0

        Beginning configuration for readline-6.2 for i386-apple-darwin12.2.0

        checking whether make sets $(MAKE)… no
        checking for gcc… no
        checking for cc… no
        checking for cl.exe… no
        configure: error: in `/Users/Mountain/Desktop/test’:
        configure: error: no acceptable C compiler found in $PATH
        See `config.log’ for more details.

        Thanks for your time,

        Loyd

  4. Maybe I didn’t post my comment on the right place, so I resubmitted !

    Thanks bhou for your tutorial ! I’ve a question : I wonder if I need to have Xcode installed to execute the commans you indicate ?

    In deed, the first command returns to me this message :

    checking build system type… i386-apple-darwin12.2.0
    checking host system type… i386-apple-darwin12.2.0

    Beginning configuration for readline-6.2 for i386-apple-darwin12.2.0

    checking whether make sets $(MAKE)… no
    checking for gcc… no
    checking for cc… no
    checking for cl.exe… no
    configure: error: in `/Users/Mountain/Desktop/test’:
    configure: error: no acceptable C compiler found in $PATH
    See `config.log’ for more details.

    Thanks for your time,

    Loyd

  5. hi everyone;
    when i try to install GNUplot in mac osx ML 10.8.2 , I got an error :
    make[2]: *** [gnuplot_x11] Error 1
    make[1]: *** [install-recursive] Error 1
    make: *** [install-recursive] Error 1
    Does anybody know how to solve this ?

  6. Thanks you saved me much time (and my employer some money). Here is a very specific listing of what worked on my MacBook Pro, running OSX 10.7, bought June 2012

    # install xcode
    # http://sourceforge.net/projects/gnuplot/files/gnuplot/ to Downloads/gnuplot-4.6.1.tar.gz
    # doubleclick it, it produces gnuplot-4.6.1.tar
    # doubleclick it again to produce folder gnuplot-4.6.1
    # download readline-6.2 from ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz
    # to Downloads/readline-6.2.tar.gz
    # doubleclick it twice to produce folder Downloads/readline-6.2
    # open Terminal, and follow my example:
    mkdir ~/Local
    cd ~/Downloads/readline-6.2
    ./configure –prefix=~/Local
    make install DESTDIR=~/Local
    # if you see error ending with the word -dynamiclib, do this:
    ( make clean ; cd shlib ; make SHOBJ_LDFLAGS=-dynamiclib )
    make clean
    make
    make install=~/Local
    cd ~/gnuplot-4.6.1
    ./configure –with-readline=~/Local
    sudo make install
    # you need to type your password here
    setenv PATH=$PATH:/usr/local/bin
    /usr/local/bin/gnuplot
    plot [-10:10] sin(x)
    # if you see your plot, it works. If not, I’m sorry.

  7. Hello everyone

    I have install gnuplot by first homebrew then type command “brew install gnuplot”. And the gnuplot installed.

    However, when I type ” plot sin(x)”. Nothing is coming out.

    Anyone can help?

    Best wishes

  8. Hello
    my english is not good,sorry,
    I have install gnuplot by first homebrew then type command “brew install gnuplot”. And the gnuplot installed.
    However, gnuplot not worked, when i retape again “brew install gnuplot” I got :
    Warning: A newer Command Line Tools release is available
    Update them from Software Update in the App Store.
    Warning: gnuplot-4.6.3 already installed, it’s just not linked

  9. … Sry, I am very bad in programming and can’t follow your instructions.
    I edit ‘Makefile.in’ in the ‘shlib’ with a program like TextEdit, right?
    If I search for ‘-dynamic’, I don’t get any results..
    😦

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