After having successfully moved my LaTeX publishing environment to the new Macbook, all that was left was a working Intel build of gnuplot 4.1.0 (which has some nice new features over 4.0). This was actually not quite easy, so I’m going to document my steps for producing a Universal Binary of Gnuplot 4.1 here for future reference.
You might also take a look at Plot. It’s a first-rate freeware plotting tool with some really great features (think ProFit or GRACE), AppleScript support, and a full-blown layout engine. All this is nicely integrated in a great looking Mac OS X GUI. I really love it.
How to Build and Install Gnuplot 4.1.0 on Mac OS X:
- Install AquaTerm. It’s currently at version 1.0.1 (built July 31, 2006) and a universal binary! Here the direct download link.
- Optionally, install Apples’s X-Windows (X11). It’s on your Mac OS X setup disk as an additional package. You do not need X11 to build or run Gnuplot. However, the pm3d mouse support for rotating and zooming is only available on X11 (i.e. not in AquaTerm).
- Install the Apple Developer CD. We require the GNU compiler and tools (XCode and the Apple Documentation is not required).
- Get Gnuplot 4.1.x from the Development Page. You might download the source from CVS. Or, as I did, download a source snapshot as a convenient .tar.gz archive. These archives can be found here. Unpack the archiv and you will have a folder named “gnuplot” on your Desktop or in your home directory.
- Now for the fun part. The sources have to be prepared, which would yield the “configure” script. To prepare we use the command
./prepare
. However, you will get an error like
Use of uninitialized value in concatenation (.) or string at /usr/bin/automake line 8449.: am_gnuplot_OBJECTS was already defined in condition INCLUDE_BINARY_C_TRUE, which is implied by condition TRUE
…
Some part of the preparation process failed.
Please refer to INSTALL for details.To fix the error, two modifcations in the file “src/Makefile.am” are required. Search for these two if-blocks and delete them or comment them out:
if INCLUDE_BINARY_C
gnuplot_SOURCES += binary.c
endif
and
if BUILD_WXWIDGETS
gnuplot_SOURCES += wxterminal/gp_cairo.c wxterminal/wxt_gui.cpp
endif
I had them at line 44-46 and 73-75.
Now run./prepare
; it should finish without any errors this time. - Now call the configure script. If you have AquaTerm installed but not X11, then use
./configure -with-x=no --without-tutorial CFLAGS=-DDEFAULTTERM=\\\"aqua\\\"
With X11 installed, instead use
./configure --without-tutorial
- Run
make
and thensudo make install
- Try the demos, like
gnuplot demo/all.dem
John said
Thanks for posting this. I was just trying to get a version of gnuplot that played well with the new Aquaterm binary. I would not have figured out the problems with the Makefile.am in src.
John said
Well, this actually does not work for me. The make command errors out. I am not sure if this is a problem with wxwidgets, but it seems likely. Adding –disable-wxwidgets to the configure circumvented the problem.
maba said
John, thanks for your tip! (However, I just re-run the steps and *for me* the –disable-wxwidgets switch is not required to build gnuplot without errors.)
Andrew Howlett said
Martin, thanks for these instructions. I had some problems compiling aquaterm support. I installed aquaterm using fink so I had to add these switches to the configure command: CPPFLAGS=-I/sw/include LDFLAGS=-L/sw/lib
Andrew Howlett said
Also, be it known that gnuplot should be compiled with gcc-3.3. Gcc 4 handles objective C differently.
later,
andrew.
Andrew Howlett said
More comments!
If you want to use the gnuplot png terminal, then you need to download, configure, compile and install several libraries BEFORE you compile gnuplot. The libraries are libgd, libpng and maybe zlib.
Andrew Howlett said
One last comment. Unfortunately I can’t edit or delete the previous comments.
Turns out I needed to install more libraries and manually copy some files to get png support. So I uploaded a short list of instructions to my web page. The URL is below. If this reply system scrubs URLs, then click on my name above to go to my web page, then look in the Mac OS X stuff section.
later,
andrew.
Philip Fowler said
Works as described for me.
Can anyone work out how to turn on autocomplete in the gnuplot terminal so one doesn’t have to type out the filenames each time?
Richard Martin-Nielsen said
These instructions worked well. With reference to Philip Fowler’s comment, I added “–with-readline=gnu” as an option in the .configure command, having first checked that fink had already installed the gnu readline library. (I use fink for various other bits of my unix-like installs.)
My final command, then, was
./configure –with-readline=gnu –program-suffix=-dev –without-tutorial CFLAGS=-DEFAULTTERM=\\\”aqua\\\”
I wished the suffix so that I wouldn’t clobber my existing 4.0 installation, but I kept aquaterm as my terminal though I have X11 installed (every so often I do use X11, but I much prefer aquaterm for most things).
Having readline functionality built in will likely make 4.1 my default gnuplot. Thanks again for the various comments and advice on this process.
Eugene said
Hi.
Stumbled onto this website. IN the process of (being forcibly :() migrating from linux after 20 years. Your how-to was excellent. Thanks!
E.
Rosario said
Hi.
I’ve got this error message while compiling
/usr/bin/ld: can’t locate file for: -lgcc_s.10.4
I’ve MAC OS X 10.4.8,
any ideas ?
many thanks
R.
Rodger said
Hi: different route.. installed xcode, installed fink and inthe process of using fink to put in octave I got gnuplot.. rather painless.. so I run it all through X11
Nick Edwards said
Can’t find the prepare script. I’m probably being really dumb but I can’t see it anywhere
florian steiner said
I have the same problem like nick.
where is the “prepare” script?
Patrick Coppock said
Like Nick and Florian above, or maybe worse, I don’t know how to run the ./prepare script.
zorg said
I suspect you don’t get ./prepare because you didn’t get the cvs snapshot. If you look in the FAQ, it tells you that you need to run prepare if you get the latest CVS. You probably just got the version on the sourceforge page, where you’re supposed to start with ./configure ….
erpfei said
Hi, My MacBook for some reason did not come with the Developer CD, so I thought I’d check for downloads (http://developer.apple.com/tools/download/). Which files specifically should I be looking for? Thanks much!
StarSiriuS‵ reSearch noteS » Blog Archive » Install Octave, Gnuplot, and AquaTerm on Mac OS X said
[…] official web siteand re-compile it. ./configure make sudo make install Although the author of this articlesaid some modifications are needed, it seems that I’m so luck that I don’t encounter the […]
stefan said
fink has a gnuplot package!
install fink, then “fink install gnuplot” – ready.
Teq said
and install FinkCommander for a quick graphical overview of Fink and point-and-click installation 😉
kopinjol said
hi,
Thanks a lot for the instructions. I followed them to the last detail but still got the following error in make :
“Undefined symbols:
“_rl_forced_update_display”, referenced from:
_restore_prompt in command.o
“_rl_ding”, referenced from:
_alert in mouse.o
“_history_list”, referenced from:
_write_history_list in history.o
“_rl_complete_with_tilde_expansion”, referenced from:
_rl_complete_with_tilde_expansion$non_lazy_ptr in plot.o
“_rl_reset_after_signal”, referenced from:
_main in plot.o
ld: symbol(s) not found
collect2: ld returned 1 exit status”
I have no idea what may be causing this. So if anyone has a tip, that’ll be great.
By the way, I didnot have the error message that you predicted on ./prepare.
thanks,
kopinjol
Zemogle said
I’m getting exactly the same problem as kopinjol. Anyone got any ideas?
Daniel said
I have the exact same problem as kopinjol and Zemogle.
Grainger said
The _rl_* errors are caused by OS X 10.5 having a fake readline library which confuses the configure script. Just add: –with-readline=builtin to the configure line and it will solve these issues.
arun said
Thanks a ton! I was struggling with various problems with my gnuplot installation! Various complaints about X11 libraries etc. But it worked fine now.
Martin Lemieux said
In my case, X11 was already installed.
Also there were no such:
if INCLUDE_BINARY_C
gnuplot_SOURCES += binary.c
endif
lines in my src/Makefile.am, so I only commented out the second group of lines at step 5.
I also had to add:
–with-readline=builtin
to the configure command at step 6.
Then everything went ok.
Btw, in my case, the executable installed in /usr/local/bin .
Puzzled said
😦 Followed all the instructions plus those within the comments, added the -with-readline=builtin (which removed my previous error) but this new one popped up. Running osx 10.5.5 on a macbook pro c2d. Anyone knows whats wrong here? Your help is greatly appreciated! 😀
From terminal:
./gnuplot.texi:10582: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:10076: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9734: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9513: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9502: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9493: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9476: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:9474: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:7413: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:4870: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:4851: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:4840: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:3459: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
./gnuplot.texi:3131: Cross reference to nonexistent node `origin’ (perhaps incorrect sectioning?).
makeinfo: Removing output file `gnuplot.info’ due to errors; use –force to preserve.
make[1]: *** [gnuplot.info] Error 1
make: *** [install-recursive] Error 1
Raymond said
Hi Puzzled,
I found the fix for your problem here:
http://article.gmane.org/gmane.comp.graphics.gnuplot.devel/7544
The keyword “origin” has been replaced in some places by “origin_”, but the fix is easy: in the source directory, use the following sed command, and run make again:
$ sed -i ‘s/origin_/origin/g’ docs/gnuplot.texi
That fixed it for me.
Michael L said
If you have macPorts installed, you can just type:
sudo port install gnuplot
http://gavmacprogramming.wordpress.com/2007/05/02/installing-gnuplot/
Eric said
Not working…
I have a MacBook Pro Intel Core 2 Duo running OS X 10.5.6. At first, I had the same problem as Kopinjol (with the _rl_* errors). I did the –with-readline=builtin thing and it fixed that part. When I did the make, I got:
make
make all-recursive
Making all in config
make[2]: Nothing to be done for `all’.
Making all in m4
make[2]: Nothing to be done for `all’.
Making all in term
make[2]: Nothing to be done for `all’.
Making all in src
Making all in wxterminal
make[3]: Nothing to be done for `all’.
gcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\”/usr/local/bin\” -DX11_DRIVER_DIR=\”/usr/local/libexec/gnuplot/4.3\” -DGNUPLOT_PS_DIR=\”/usr/local/share/gnuplot/4.3/PostScript\” -DCONTACT=\”gnuplot-bugs@lists.sourceforge.net\” -DHELPFILE=\”/usr/local/share/gnuplot/4.3/gnuplot.gih\” -DGNUPLOT_X11=\”`echo gnuplot_x11 | sed ‘s,x,x,’`\” -g -O2 -ObjC -MT alloc.o -MD -MP -MF .deps/alloc.Tpo -c -o alloc.o alloc.c
mv -f .deps/alloc.Tpo .deps/alloc.Po
….
…
In file included from term.h:173,
from term.c:1368:
../term/aquaterm.trm: In function ‘AQUA_boxfill’:
../term/aquaterm.trm:586: warning: ‘AQTAdapter’ may not respond to ‘-setColorRed:green:blue:alpha:’
../term/aquaterm.trm:586: warning: (Messages without a matching method signature
../term/aquaterm.trm:586: warning: will be assumed to return ‘id’ and accept
../term/aquaterm.trm:586: warning: ‘…’ as arguments.)
../term/aquaterm.trm: In function ‘AQUA_filled_polygon’:
../term/aquaterm.trm:683: warning: ‘AQTAdapter’ may not respond to ‘-setColorRed:green:blue:alpha:’
mv -f .deps/term.Tpo .deps/term.Po
gcc -DHAVE_CONFIG_H -I. -I.. -I../term -I../term -DBINDIR=\”/usr/local/bin\” -DX11_DRIVER_DIR=\”/usr/local/libexec/gnuplot/4.3\” -DGNUPLOT_PS_DIR=\”/usr/local/share/gnuplot/4.3/PostScript\” -DCONTACT=\”gnuplot-bugs@lists.sourceforge.net\” -DHELPFILE=\”/usr/local/share/gnuplot/4.3/gnuplot.gih\” -DGNUPLOT_X11=\”`echo gnuplot_x11 | sed ‘s,x,x,’`\” -g -O2 -ObjC -MT time.o -MD -MP -MF .deps/time.Tpo -c -o time.o time.c
mv -f .deps/time.Tpo .deps/time.Po
….
….
gcc -g -O2 -ObjC -o bf_test bf_test.o binary.o alloc.o -laquaterm -framework Foundation
Making all in docs
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../src -I../term -g -O2 -ObjC -c doc2gih.c
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../src -I../term -g -O2 -ObjC -c termdoc.c
gcc -g -O2 -ObjC -o doc2gih doc2gih.o termdoc.o -laquaterm -framework Foundation
./doc2gih ./gnuplot.doc gnuplot.gih
Making all in lisp
make[2]: Nothing to be done for `all’.
Making all in man
make[2]: Nothing to be done for `all’.
Making all in demo
Creating binary data files
Making all in tutorial
make[2]: Nothing to be done for `all’.
Making all in share
Making all in LaTeX
make[3]: Nothing to be done for `all’.
make[3]: Nothing to be done for `all-am’.
make[2]: Nothing to be done for `all-am’.
And I got the following when I did make install, I got:
Making install in config
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
Making install in m4
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
Making install in term
make[2]: Nothing to be done for `install-exec-am’.
test -z “/usr/local/share/gnuplot/4.3/PostScript” || .././install-sh -c -d “/usr/local/share/gnuplot/4.3/PostScript”
/usr/bin/install -c -m 644 ‘PostScript/cp1250.ps’ ‘/usr/local/share/gnuplot/4.3/PostScript/cp1250.ps’
/usr/bin/install -c -m 644 ‘PostScript/cp437.ps’ ‘/usr/local/share/gnuplot/4.3/PostScript/cp437.ps’
….
…
/usr/bin/install -c -m 644 gnuplot.elc /usr/local/share/emacs/site-lisp/gnuplot.elc
/usr/bin/install -c -m 644 gnuplot-gui.elc /usr/local/share/emacs/site-lisp/gnuplot-gui.elc
Making install in man
make[2]: Nothing to be done for `install-exec-am’.
test -z “/usr/local/share/man/man1” || .././install-sh -c -d “/usr/local/share/man/man1”
/usr/bin/install -c -m 644 ‘./gnuplot.1’ ‘/usr/local/share/man/man1/gnuplot.1′
make install-data-hook
make[3]: Nothing to be done for `install-data-hook’.
Making install in demo
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
Making install in tutorial
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
Making install in share
Making install in LaTeX
make[3]: Nothing to be done for `install-exec-am’.
make install-data-hook
make[3]: Nothing to be done for `install-exec-am’.
test -z “/usr/local/lib/X11/app-defaults” || .././install-sh -c -d “/usr/local/lib/X11/app-defaults”
/usr/bin/install -c -m 644 ‘Gnuplot’ ‘/usr/local/lib/X11/app-defaults/Gnuplot’
make[2]: Nothing to be done for `install-exec-am’.
make[2]: Nothing to be done for `install-data-am’.
and then when I try to start gnuplot, it says the good old “command not found”…. What to do? Help! Thanks a lot in advance
TonyMac said
@grainger:
next to the pb of kopinjol and Zemogle: the option –with-readline=builtin effectively solves the missing of the readline. but the gnuplot will be installed without the autocompletion features (TAB key gives nothing as completion and so on). THerefore the –with-readline=gnu will give error when compiling sources. THe solution is to install GNU readline that u can find at:
http://tiswww.case.edu/php/chet/readline/rltop.html
which is really simple to install (./configure // make // sudo make install ) n u are done.
After installed GNU readline u can use the make issu from the configure –with-readline=gnu
Miguel said
Octave distributes updated binaries of gnuplot for Mac OS X.
http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary
http://octave.sourceforge.net/
Peggy Li said
Hi
I have downloaded gnuplot-4.4.0 for my MacBook Pro. I have untar(ed) it and pulled it to my Desktop. I followed your webpage to install it. Firstly, I go to the gnuplot-4.4.0 directory (i.e., cd gnuplot-4.4.0) and then typed ./prepare (to yield the “configure” script. However, I received the error message “No such file or directory”. Please advise what should I do. Do I need to pull the folder “gnuplot-4.4.0” to the “application folder”. Or Where should I put the “gnuplot-4.4.0” folder? Hope that you could help!
Peggy Li
Peggy Li said
Further to my earlier comment. My MacBook Pro has X11 installed.
Peggy Li
TonyMac said
@Li: I didn’t understand your command ./prepare, have u simply to try ./configure and follow those steps as described in the README & INSTALL text file
Ram Adhikari said
awesome post… worked like a charm :).
Thanks a ton.