Contents

Using package manager

If you are looking for an already built version of Octave for Mac OS X, at the present there doesn't exist a reliable one. Instead, use a package manager.

Source-Compilation

Before building Octave from scratch on a Mac OS X platform you need to install several GNU programs and libraries that are not shipped with your Mac. This description will guide you through the procedure of GNUifying your Mac OS X step by step, so that you are then be able to configure, compile, install and run the Octave program.

If available, then binary-releases of the necessary programs are preferred by this description, otherwise there is no other way as to configure, compile and install other source-releases of these programs. The minimalistical requirements for installing these programs on your Mac are that you have at least Mac OS X version 10.4.x running on your Mac (either Core Duo or PPC).

The section "Step-By-Step Procedure" describes which programs resp. packages have to be installed at least before trying to compile Octave. The section "Extensions" describes which programs resp. packages have to be installed before trying to compile Octave to reach full functionality. The section "Troubleshooting" describes what to do if one ore more package creation processes fail.

Step-By-Step Procedure

(1) Install the Xcode-Tools (ie. the gcc-suite, the c-library and other tools) that are shipped with your computer from "Mac OS X Install Disc 1". Optionally you can get the latest version of these tools from http://developer.apple.com/tools/download. Follow the instructions from the "About Xcode Tools.pdf" file on how to install these tools. Make sure that you have installed the latest releases.

Also read the troubleshooting part at the bottom of this file for further details about which build tools could also make troubles.

(2) Install the X11 environment (ie. the Xserver application etc.) that are shipped with your computer from "Mac OS X Install Disc 1". The X11 environment can be installed via the "Optional Installs.mpkg" program and is needed by various graphics programs (10). Make sure that you have installed the latest release. Choose "Software-Update" in your menu bar to download and to reinstall the latest versions.

(3) Prepare a directory and the settings on your environment for installing the following programs and libraries. Create the directory /usr/local that is not present by default on your new Mac and set up some variables in either your .profile file (if you plan to use the Terminal.app from Mac OS X for compiling Octave) or your .bashrc file (if you plan to use the terminal application from your X11 environment). Do this the following way:

(4) Download and install a binary-release of a Tex environment for your Mac in order to build the documentation for Octave. One of the binary-distributions that can be downloaded from Internet at this time is the Mac-Tex environment that can be found there http://tug.org/mactex. Follow the installation instructions provided by this package. Either edit your .profile or .bashrc file (3) the following way:

export PATH=$PATH:/usr/local/teTeX/bin/i386-apple-darwin-current

With the Mactex-2007 package the binary path has been changed. Use the following line if you have a new Mactex-2007 package and a IA:

export PATH=$PATH:/usr/local/texlive/2007/bin/i386-darwin

or on PPC use this line

export PATH=$PATH:/usr/local/texlive/2007/bin/powerpc-darwin

(5) Download and install a binary-release of a Fortran-compiler environment for your Mac. One of the binary-distributions that can be downloaded from Internet at this time is the GFortran environment. It is hosted at http://www.macresearch.org. The GFortran compiler is shipped in a binary-tar.gz file. Unpack and install this program the following way:

Also read the troubleshooting part at the bottom of this file for further details about which Fortran compiler to use for Mac OS X.

(6) Download and install a source-release of the program "sed" because the one that is implied in Mac OS X is a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest sed program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/sed. Unpack, configure, compile and install this program the following way:

Also read the troubleshooting part at the bottom of this file for further details if an error occurs at compilation.

(7) Download and install a source-release of the program "bison" because the one that is implied in Mac OS X a BSD-flavoured POSIX version and a GNU version is required to build Octave. The source-release of the latest bison program can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/bison. Unpack, configure, compile and install this program the following way:

(8) Download and install a source-release of the program "gawk". Gawk is not included in Mac OS X (the program "awk" is included in Mac OS X but "gawk" is needed to compile Octave). The source-version of the latest gawk-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/gawk. Unpack, configure, compile and install this program the following way:

(9) Download and install a source-release of the "readline" library. There is already a readline-library included in Mac OS X but by now I do not know how to include the installed version in the compilation procedure of Octave. The source-version of the latest readline-release can be downloaded from Internet at http://ftp.gnu.org/pub/gnu/readline. Unpack, configure, compile and install this program the following way:

(10) Download and install a source-release of the program "gnuplot". The source-release of the latest gnuplot program can be downloaded from Internet at http://www.gnuplot.info. Unpack, configure, compile and install this program the following way:

(**) You are already done setting up your Mac OS X for configuring, building, installing and running the minimalistic version of Octave. If you want full Octave functionality you need to download and install more source packages before building Octave, read the EXTENSIONS part of this file at the bottom.

(11) Download and install a source-release of the latest "octave" program. The latest release can always be found at http://www.octave.org. Unpack, configure, compile and install this program the following way:

Also read the troubleshooting part at the bottom of this file for further details if an error occurs at compilation.

(12) Enjoy using Octave!

Extensions

For using the full functionality of Octave some more source-packages need to be installed on your Mac.

(+A) Download and install a source-release of the "pcre" library. There is no pcre-library included in Mac OS X. The source-version of the latest pcre-release can be downloaded from Internet at http://www.pcre.org. Unpack, configure, compile and install this program the following way:

(+B) Download and install a source-release of the "hdf5" library. There is no hdf5-library included in Mac OS X. The source-version of the latest hdf5-release can be downloaded from Internet at ftp://ftp.hdfgroup.org/HDF5/current/. Unpack, configure, compile and install this program the following way:

Note for HDF5 version 1.8.0: Make sure CPPFLAGS contains "-DH5_USE_16_API" when configuring Octave.

(+C) Download and install a source-release of the "fftw" library. There is no fftw-library included in Mac OS X. The source-version of the latest fftw-release can be downloaded from Internet at http://www.fftw.org. Unpack, configure, compile and install this program the following way:

(+D) Download and install a source-release of the "curl" library. There is no curl-library included in Mac OS X. The source-version of the latest curl-release can be downloaded from Internet at http://curl.haxx.se. Unpack, configure, compile and install this program the following way

(+E) Download and install a source-release of the "glpk" library. There is no glpk-library included in Mac OS X. The source-version of the latest glpk-release can be downloaded from Internet at http://ftp.gnu.org/gnu/glpk. Unpack, configure, compile and install this program the following way

(+F) Download and install a source-release of the "suitesparse" library. There is no suitesparse-library included in Mac OS X. The source-version of the latest release can be downloaded from Internet at http://www.cise.ufl.edu/research/sparse/SuiteSparse. Edit file UFconfig/UFconfig.mk and replace (in about line 76) "-lgoto" with "-lblas". The metis source package is also needed to build the "suitesparse" library, it can be downloaded from internet at http://glaros.dtc.umn.edu/gkhome/views/metis. Unpack, configure, compile and install this program the following way

The problem after compiling the "suitesparse" is, that a make install script does not exist. A shell script like the following one could be used to copy all header files and libraries to the /usr/local directory. Run this script in the suitesparse directory as "sudo":

Troubleshooting

(1) There are reports on the mailing lists of Octave, that automake also needs to be updated because the version that is shipped with Mac OS X doesn't work (especially with G5 Macs this problem may occur). So you might need to install a newer version than the one shipped with your Mac.

On Core Duo Macs it might appear, that compilation of libcruft/misc/machar.c fails because of a missing define, resp. a define that is in the code but is missinterpreted by the make program of your Mac. So you should do the following before configuring Octave:

This is a known Mac OS X problem for over years now and may occur if you have multiply version of Fortran compilers installed on your system. GFortran is one of the known Fortran compilers that do work very well with the gcc-suite that is shipped with your computer. When running "./configure" in your Octave path then make sure that GFortran is the one and only Fortran compiler on your system (the fink version of gfortran installed with the package gcc42 also works).

(3) When installing sed there may occur an error that sed cannot be build. This is a known problem, you first need a working sed (the one implied in Mac OS X a BSD-flavoured POSIX version and a GNU version is required to build Octave) to build another sed for your system, so do the following:

(4) On PPC Macs it seems like you need to add another linker option that will not be added by default. If you see an error like

ld: Undefined symbols:
_do_fio
_e_wsfe...

you should better do at step ( 3) for also taking the libg2c.dylib library at linking time and that the linker finds the desired functions:

export LDFLAGS="$LDFLAGS -lg2c"

(5) I have found that when using recent versions from CVS (cerca 02/26/2007) that I have to add the following directories to the DYLD_LIBRARY_PATH in order for Gnuplot to work properly. This may be a simple artifact of how I have Fink setup, but may be helpful to someone in the future. Wihout these directories specified, plotting functions gave errors about incompatibilities between libgd and the fontconfig or freetype libraries: