Sunday, 4 September 2011

How to install Octave on Mac OS X Snow Leopard

I found that the easiest way to install Octave is to download the binary file from ="http://sourceforge.net/projects/octave/files/Octave%20MacOSX%20Binary/">here. It can just be installed by dragging and dropping, which is great. Alternatively, the instructions to install Octave from the source is available from the Octave homepage.

For snow leopard, make sure to apply the following fix to get Octave to work as mentioned here:

NOTES FOR SNOW LEOPARD USERS
1 - mkoctfile
Since OSX 10.6 the Apple shipped version of gcc builds by default 64bit binaries.
As the libraries included with Octave.app version 3.2.3 are 32bit, you need to apply the following patch in order for mkoctfile to work:
1.1) open the folder /Applications in the finder
1.2) right-click on Octave.app and select "show package contents"
1.3) navigate to /Applications/Octave.app/Contents/Resources/bin
1.4) right-click on the file "mkoctfile" and select "Open with -> Other ... -> TextEdit.app"
1.5) right after the line:

# along with this program; If not, see http://www.gnu.org/licenses/.

add the lines

CFLAGS="-m32 ${CFLAGS}"
FFLAGS="-m32 ${FFLAGS}"
CPPFLAGS="-m32 ${CPPFLAGS}"
CXXFLAGS="-m32 ${CXXFLAGS}"
LDFLAGS="-m32 ${LDFLAGS}"

and save.


A binary for Gnuplot is included in the octave.dmg, which is needed to plot graphs. However, if Gnuplot is already installed on your system (see here for a short how-to) you will have to set the environment variable for the gnuplot terminal to use X11, or octave may give errors if aquaterm is not installed. To do so, just add:

export GNUTERM=X11

to your .bash_profile

If you wish to use the binary for gnuplot (version 4.2 as of writing) from the octave.dmg, look here on how to get it to work properly.

No comments:

Post a Comment