Octave problems on Mac OS X 10.5.8

I recently needed to do some math. So I downloaded and installed Octave, as it’s a great package. After installing both Octave and GNUPlot I tried to draw a graph, no luck. I got the same error over and over.

dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later,
  but libfreetype.6.dylib provides version 10.0.0
dyld: Library not loaded: /usr/X11/lib/libfreetype.6.dylib
  Referenced from: /usr/X11R6/lib/libfontconfig.1.dylib
  Reason: Incompatible library version: libfontconfig.1.dylib requires version 13.0.0 or later,
  but libfreetype.6.dylib provides version 10.0.0
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot\: line 71\:  5956 Trace/BPT trap
 GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}"
 DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}"
 DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}"
 DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$@"
/Applications/Gnuplot.app/Contents/Resources/bin/gnuplot\: line 71\:  5958 Trace/BPT trap
 GNUTERM="${GNUTERM}" GNUPLOT_HOME="${GNUPLOT_HOME}" PATH="${PATH}"
 DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}" HOME="${HOME}" GNUHELP="${GNUHELP}"
 DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}" GNUPLOT_PS_DIR="${GNUPLOT_PS_DIR}"
 DISPLAY="${DISPLAY}" GNUPLOT_DRIVER_DIR="${GNUPLOT_DRIVER_DIR}" "${ROOT}/bin/gnuplot-4.2.6" "$@"
error\: you must have gnuplot installed to display graphics; if you have gnuplot installed
 in a non-standard location, see the 'gnuplot_binary' function

My computer is an old PPC laptop, this means I can only use the .dmg of Octave 3.2.3, so I thought is was a config problem with 10.5.8 versus 10.6 or 10.7, or a problem with Octave 3.2.3 versus Octave 3.4.0. These were not the case. It turns out the problem is with GNUPlot upstream not X11, Octave or even aqua Terminal. The solution was found on 2 pages; the German version of this Stack Overflow page.

2 - Gnuplot.app
An update to system libraries introduced with OSX 10.6.5 has broken the functionality of the
Gnuplot.app included with the Octave.app distribution, in order to use Gnuplot.app on OSX 10.6.5
and later, you can use the fix described below:

2.1) open the folder /Applications in the finder
2.2) right-click on Gnuplot.app and select "show package contents"
2.3) navigate to /Applications/Gnuplot.app/Contents/Resources/bin
2.4) right-click on the file "gnuplot" and select "Open with -> Other ... -> TextEdit.app"
2.5) change the line:
 DYLD_LIBRARY_PATH="${ROOT}/lib:${DYLD_LIBRARY_PATH}"
to
 DYLD_LIBRARY_PATH="${ROOT}/lib"
and save.

So you remove the reliance on :${DYLD_LIBRARY_PATH} and that is it. While there, I also changed

DYLD_FRAMEWORK_PATH="${ROOT}/lib:${DYLD_LIBRARY_PATH}"

to

DYLD_FRAMEWORK_PATH="${ROOT}/lib"

on the following line, just in case. ;)

I also made GNUPlot an X11 only app by changing the startup “script” from with instructions from this page by David Prakash

do script ("exec '${ROOT}/bin/gnuplot'")

to

do script ("GNUTERM=x11 exec '${ROOT}/bin/gnuplot'")

and once I restarted Terminal Octave works fine across the Terminal / X11 Term divide. Here’s a picture showing that you can use Terminal and Octave with X11 and GNUPlot.

gnuplot

Michael 20120217

Last rendered on 17 February 2012 at 13:15.