GNU Octave is a high-level language, primarily intended for numerical
computations. It provides a convenient command line interface for
solving linear and nonlinear problems numerically, and for performing
other numerical experiments using a language that is mostly compatible
with Matlab. It may also be used as a batch-oriented language.
Introduction
GNU Octave is a high–level language, primarily intended for
numerical computations. It provides a convenient command line interface
for solving linear and nonlinear problems numerically, and for
performing other numerical experiments using a language that is mostly
compatible with Matlab. It may also be used as a batch–oriented
language. For further information visit http://www.octave.org.
Octave.app
is a ready–to–run binary version of GNU Octave. It runs on most of
Apple's Mac OS X computers and comes with all the free libraries that
are needed. The application can also be expanded by downloading and
installing further packages from the Octave–Forge's website at http://octave.sourceforge.net.
If
you like GNU Octave resp. Octave.app then please also think about of
making a contribution to the Core Octave Development team. Instructions
are given at http://www.gnu.org/software/octave/funding.html.
License
The source code for GNU Octave, the binary Octave.app and the package file octave-3.2.2-i386.dmg are freely redistributable under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation (FSF).
Simply
put, the GPL says that anyone who redistributes the software, with or
without changes, must pass along the freedom to further copy and change
it. By distributing the complete source code for GNU Octave under the
terms of the GPL, we guarantee that you and all other users will have
the freedom to redistribute and change Octave.
Releasing the source code for Octave has another benefit as
well. By having access to all of the source code for a mathematical
system like Octave, you have the ability to see exactly how each and
every computation is performed. There are no black boxes that hide the
details of any calculation.
Although enhancements to Octave that are written as
function files in Octave's scripting language are not required to be
redistributed under the terms of the GPL, we encourage you to release
your enhancements to Octave under the same terms for the benefit of all
users. We also encourage you to submit your changes for inclusion in future versions of Octave.
Requirements
If your Apple computer comes with Motorola's PowerPC processor G4 or
newer then you need to have installed at least Mac OS X version 10.4.
Octave.app for Apple's PPC Macs has been optimized for G4 processors
and newer, it doesn't work on G3 processors. Download the file octave-3.2.2-ppc.dmg that includes the ready–to–run binary version of GNU Octave for PPC Macs.
If
you have an Apple computer that comes with an Intel processor then you
need to have installed at least Mac OS X version 10.4. Download the
file octave-3.2.2-i386.dmg that includes the ready–to–run binary version of GNU Octave for Intel Macs.
If you want to use graphical outputs from Octave that can be made with the commands plot, mesh, surf etc. then Gnuplot can be installed (cf. General FAQ
about 'Do I have to install Gnuplot.app from the Extras directory?').
Since Octave.app version 3.2.0 there i sno need to install Gnuplot
anymore because Octave.app comes with its first own graphical backend
cf. General FAQ
about 'How can I switch between different graphical backends?').
Gnuplot.app is a separate Mac application because it can be build,
installed and run for its own (for further information about Gnuplot
visit the Gnuplot website).
If you want to further install Octave packages from eg. the Octave–Forge's project website
then you must install the “Apple's XCode Tools” from 'DVD 1 of your Mac
OS X Install Discs' before. To make sure that you have installed the
latest version available also visit Apple's XCode Tools website.
Installation
Installing Octave.app is very easy. Just drag the Octave.app icon from the octave-3.2.2-i386.dmg package to another place of your filesystem (eg. to your Desktop or even better to your Applications
folder) and that's it, you're done. This drag'n–drop does not install
any files elsewhere on your hard disk drive. Double–click the
Octave.app icon to startup Octave.
If you also want to create plots on your Desktop or if you
want to create plots that are saved as an image file then it might be
useful that you place Gnuplot.app into the same directory where
Octave.app resides (eg. once again to your Desktop or even better to your Applications folder). The application Gnuplot.app can be found as an extra binary package in the Extras directory of octave-3.2.2-i386.dmg.
To remove Octave.app and/or Gnuplot.app completely, just drag the Octave.app and/or Gnuplot.app icon and drop it over the Trash.
If you are looking for the GNU Octave manual as a *pdf file or other useful documents about GNU Octave then have a look at the Doc folder of your octave-3.2.2-i386.dmg file.
Limitations
There are currently some known limitations when using Octave.app.
These limitations need not to be reported on an Octave mailing list.
Please consider adapting the Octave.app build scripts at http://octave.sourceforge.net in the directory admin/MacOSX/Octave.app
so that future versions of Octave.app become even better. If you find
other bugs or other limitations in Octave.app respectively GNU Octave
then please report them to octave-dev@lists.sourceforge.net.
Fortran90 code files cannot be compiled.
Fortran90 and Fortran95 code files etc. cannot be compiled when using the command mkoctfile on the command line or when using the commands mkoctfile or mex in Octave. The reason is that the program f2c
has been set up in Octave.app that can just convert Fortran77 code
files into C–files. The generated C–files are then compiled with the gcc
compiler that comes with your “Apple's XCode Tools” (Install these
tools from 'DVD 1 of your Mac OS X Install Discs'). We've also added
the script fort77 to Octave.app that behaves like a Fortran compiler but in the background calls f2c and gcc automatically.
The f2c
program is one of the smallest and oldest free Fortran converters
available. Setting up another Fortran compiler that can compile
Fortran90 and Fortran95 code files (eg. g95 or gfortran) for all the different versions of “Apple's XCode Tools” all the different versions of gcc is too difficult. We hope that g95 or gfortran somewhen become part of “Apple's XCode Tools” so that we do not need to set up f2c and fort77 anymore.
Note: Octave.app versions 3.2.0 or newer are bundled with a g95 Fortran compiler instead of fort77 and f2c. This problem only exists for Octave.app versions 3.0.x or older.
Some packages from Octave–Forge's website cannot be installed.
Some of Octave–Forge's packages cannot be installed because of a missing g95 or gfortran
command as described in the section before. Known packages that cannot
be installed because they come with Fortran90 code files are
- Main repository: Optiminterp
- Nonfree packages: Spline-gcvspl
If you find other bugs or other limitations in other packages of Octave–Forge then please report them to octave-dev@lists.sourceforge.net. If you want to find out more information why eg. the installation for a specific package fails then use the command pkg install --verbose <package.tar.gz> to build a package in verbose mode.
Note: Octave.app versions 3.2.0 or newer are bundled with a g95 Fortran compiler instead of fort77 and f2c. This problem only exists for Octave.app versions 3.0.x or older.
No spaces (and/or special characters) in the pathname before Octave.app are allowed.
Do not install Octave.app in a place of your filesystem including spaces (and/or special characters, eg. any of '?!'()@...' and more) in the pathname before Octave.app. Valid destinations eg. are
/Application/Octave.app
/Users/Me/Desktop/Octave.app
Not valid destinations including spaces and/or special characters in the pathname eg. are
/Applications/Other Apps/Octave.app
/Users/Me@Home/Desktop/Octave.app
/Users/Me&Others/Applications/Octave.app
/Users/Foo^13/Applications/Octave.app
If you set up Octave.app with a not valid pathname then
this might result in different errors at startup (or when already
running Octave.app) that normally cannot be reproduced.
General FAQ
Octave took over my Terminal.app - what can I do?
There is a bug in Terminal.app if you press the “Apply All” menu in the menubar while running Octave.app (or while running Perl or Python or Tcl or any other interactive command line tool). A description about “What is going on here?” can be found at http://www.macusenet.com/archive/index-t-36473.html. However, the problem can be solved by starting a bash session from Octave and remove the Terminal.app preferences file (this will reset Terminal.app to default), eg.
octave-3.2.2:1> system ("exec bash")
bash ~$ rm ~/Library/Preferences/com.apple.terminal.plist
Then close all your Terminal.app windows (further, close Terminal.app in your Dock)
and then restart Terminal.app again. The best solution to avoid this
bug is to never press the “Apply All” menu button in Terminal.app.
Is there a 64–bit version of Octave.app available?
There is no 64–bit version of Octave.app available. Please consider adapting the Octave.app build scripts at http://octave.sourceforge.net in the admin/MacOSX directory so that we can easily build an release for 64–bit platforms as well.
How can I startup Octave.app?
After Octave.app has been placed to your ~/Desktop or to your /Applications
folder or anywhere else on your hard disk drive you can double–click
the Octave.app icon. This opens a new Terminal.app window and executes
Octave.
Another way to open Octave.app is to use the command open from Terminal.app's command line. If you have installed Octave.app in your Applications folder then a one time startup might look like eg.
bash ~$ open /Applications/Octave.app
How can I startup Octave.app with a XTerm window?
If you prefer using a XTerm that comes with your “X11 runtime
environment” instead of Terminal.app (Install the “X11 runtime
environment” from 'DVD 1 of your Mac OS X Install Discs') then set up
the environment variable OCTAVE_TERMINAL=x11 before
starting Octave.app. A description about how to set up environment
variables for all processes launched by a specific user can be found at
http://developer.apple.com/qa/qa2001/qa1067.html. If you installed Octave.app in your Applications folder then a one time startup might look like eg.
bash ~$ export OCTAVE_TERMINAL=x11 # Note: lower case letter 'x'
bash ~$ open /Applications/Octave.app
or even better
bash ~$ OCTAVE_TERMINAL=x11 open /Applications/Octave.app
How can I startup Octave in a Terminal.app or a XTerm that is already running?
A modified startup script has been placed into Octave.app that can
be used to startup Octave in an already running Terminal.app or a XTerm
window. The place of this startup script is <Octave.app>/Contents/Resources/bin/octave. If you have installed Octave.app in your Applications folder then a startup in your already running Terminal.app or XTerm application might look like eg.
bash ~$ /Applications/Octave.app/Contents/Resources/bin/octave
Another way to use GNU Octave from the command line is to
set up a link to the Octave startup script of Octave.app that is placed
somewhere in your system's search PATH. If you have installed Octave.app in your Applications folder then setting up a link and starting up Octave might look like eg.
bash ~$ sudo ln -sfv /Applications/Octave.app/Contents/Resources/bin/octave /usr/bin/octave
bash ~$ octave
How can I use mkoctfile in a Terminal.app or a XTerm that is already running?
A modified mkoctfile script has been placed into Octave.app that can be used to run mkoctfile in an already running Terminal.app or a XTerm window. The place of this startup script is <Octave.app>/Contents/Resources/bin/mkoctfile. If you have installed Octave.app in your Applications folder then the usage of the command mkoctfile might look like eg.
bash ~$ /Applications/Octave.app/Contents/Resources/bin/mkoctfile <file.cc>
Another way to use the command mkoctfile from the command line is to set up a link to the modified mkoctfile startup script of Octave.app that is placed somewhere in your system's search PATH. If you have installed Octave.app in your Applications folder then setting up a link and using mkoctfile might look like eg.
bash ~$ sudo ln -sfv /Applications/Octave.app/Contents/Resources/bin/mkoctfile /usr/bin/mkoctfile
bash ~$ mkoctfile <file.cc>
Can I add Octave.app's bin–path to my local search path?
Never, really never, add the <Octave.app>/Octave.app/Contents/Resources/bin to your local search path!
Octave.app comes with some more binaries that should not be found from
any other program or application of your system. Instead, create links
to the modified startup scripts like described before or create aliases
by putting the following lines into your ~/.bashrc file and/or your ~/.profile file
alias octave="/Applications/Octave.app/Contents/Resources/bin/octave"
alias mkoctfile="/Applications/Octave.app/Contents/Resources/bin/mkoctfile"
Do I have to install Gnuplot.app from the Extras directory?
If you have a working Gnuplot program (at least version 4.2.2 or
higher) already installed on your system and if this Gnuplot program is
found from any place of Terminal.app's command line interface then
there is no reason to install Gnuplot.app. Try the following example in
your Terminal.app or XTerm window to test if either a Gnuplot
application is already found on your system or if Gnuplot.app should be
installed
bash ~$ gnuplot
If you need to install Gnuplot.app then there are two ways to set this up:
- Drag the Gnuplot.app icon from the compressed disc image to the
same directory where Octave.app resides (eg. both applications
Octave.app/Gnuplot.app are put to the Desktop or even better to your Applications folder). Octave.app then automatically finds everything needed and starts Gnuplot.app automatically if desired.
- Drag
the Gnuplot.app icon from the compressed disc image to another place of
your filesystem. After you did that you need to create a link to the
modified Gnuplot startup script to tell Octave.app where Gnuplot.app
can be found, eg.
bash ~$ ln -sfv <Gnuplot.app>/Contents/Resources/bin/gnuplot /usr/bin/gnuplot
After that try from any place of your filesystem if Gnuplot can be started and further if Gnuplot displays plots correctly, eg.
bash ~$ gnuplot # Gnuplot.app is started
gnuplot> plot sin(x)/x # A figure window shows a nice sine wave
I set up Gnuplot.app but it doesn't interact with Octave.app, what can I do?
If you see an Octave output of the form
octave-3.2.2:1> x = [-pi:0.1:pi];
octave-3.2.2:2> plot (x, sin (x))
Expected X11 driver: /tmp/gnuplot-i386/libexec/gnuplot/4.2/gnuplot_x11
Exec failed: No such file or directory
See 'help x11' for more details
then there is something going wrong on your system. There may exist and old ~/.gnuplotrc file in your home
directory or anything else on your system tells Gnuplot.app to open
with the X11 backend. A solution to solve this problem is that you set
up an environment variable GNUTERM=aqua or GNUTERM=x11. A description about how to set up environment variables for all processes launched by a specific user can be found at http://developer.apple.com/qa/qa2001/qa1067.html.
Note: Also read the README.html file of the Gnuplot.app compressed disc image for setting up Gnuplot.app correctly.
Packages FAQ
Do I have to rebuild installed packages if I move Octave.app to another place?
We did some tests and it looks good that you don't need to rebuild locally installed packages if you move Octave.app to another place. If you find out that this doesn't work then please report to octave-dev@lists.sourceforge.net.
Another solution however is to install packages generally with the -global
flag. Then packages are installed inside of Octave.app and if you
decide to move Octave.app to another place then packages are moved too,
eg.
octave-3.2.2:1> pkg install -global <package.tar.gz>
Do I have to rebuild installed packages if I upgrade Octave.app?
If you upgrade Octave.app to a newer version and the GNU Octave API
version number has been changed between the old and the new version
then yes, you need to rebuild all installed packages (eg. if you
upgrade Octave.app from 2.9.18 to Octave.app 3.0.0). About “rebuilding
a package” please have a look at the help page of the pkg command, eg.
octave-3.2.2:1> help pkg
How can I install another package that also depends further libraries?
There are some packages at http://octave.sourceforge.net
available that do depend other resp. further libraries that may not
already have been installed on your Mac system, eg. the “GSL–package”,
the “octcdf–package” and the “Symbolic–package” and others. Therefore
you need to download, configure, compile and install the needed
libraries before. Examples are shown in the next sections.
How can I install the gsl–package from Octave–Forge that also depends further libraries?
Note: this example leans against the installation of the package gsl-1.0.0.tar.gz
and an Octave.app version 2.9.12. There may be newer versions of the
GSL–sources, the Octave.app application and the Octave–Forge
GSL–package available at the download sites.
As described previously you need to download, configure,
compile and install the needed library before you install the
Octave–Forge package.
- Download a current version of the GNU scientific library from a GNU webserver, eg.
bash ~$ curl -s -S ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz -o gsl-1.9.tar.gz
- Unpack the downloaded library and change into the directory that has been created, eg.
bash:~$ tar -xzf gsl-1.9.tar.gz
bash:~$ cd gsl-1.9
- Configure, compile and install the library to the directory <Octave.app>/Contents/Resources specified by the flag --prefix, eg.
bash:~/gsl-1.9$ ./configure --prefix=/Applications/Octave.app/Contents/Resources
bash:~/gsl-1.9$ make && make install
- Startup Octave.app and install the desired Octave–package, eg.
octave-2.9.12:1> pkg install gsl-1.0.0.tar.gz
How can I install the symbolic–package from Octave–Forge that also depends further libraries?
Note: First you should know here that you need very new versions of the developer programs flex, bison, gawk and automake
to be able to install all the dependencies of this package (the
versions that come with your Mac maybe don't work). Let's also say that
you have set up these programs in the directory /usr/local/bin. This example leans against the installation of the package symbolic-1.0.3.tar.gz
and an Octave.app version 2.9.12. There may be newer versions of the
PKG-CONFIG-, CLN- and GiNaC–sources, the Octave.app application and the
Octave–Forge GSL–package available at the download sites. Finally you
need to download, configure, compile and install the needed libraries
before you install the Octave–Forge package, eg.
- Download a current version of the pkg–config software, eg.
bash:~$ curl -s -S http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz \
-o pkg-config-0.22.tar.gz
- Unpack the downloaded library and change into the directory that has been created, eg.
bash:~$ tar -xzf pkg-config-0.22.tar.gz
bash:~$ cd pkg-config-0.22
bash:~/pkg-config-0.22$
- Configure, compile and install the library to the directory <Octave.app>/Contents/Resources specified by the flag --prefix, eg.
bash:~/pkg-config-0.22$ ./configure --prefix=/Applications/Octave.app/Contents/Resources
bash:~/pkg-config-0.22$ make && make install
- Download a current version of the CLN — Class Library for Numbers, eg.
bash:~$ curl -s -S ftp://ftpthep.physik.uni-mainz.de/pub/gnu/cln-1.1.9.tar.bz2 \
-o cln-1.1.9.tar.bz2
- Unpack the downloaded library and change into the directory that has been created, eg.
bash:~$ tar -xjf cln-1.1.9.tar.bz2
bash:~$ cd cln-1.1.9
bash:~/cln-1.1.9$
- Configure, compile and install the library to the directory <Octave.app>/Contents/Resources specified by the flag --prefix, eg.
bash:~/cln-1.1.9$ PATH=/Applications/Octave.app/Contents/Resources/bin:{$PATH} \
./configure --prefix=/Applications/Octave.app/Contents/Resources
bash:~/cln-1.1.9$ make && make install
- Download a current version of the GiNaC (GiNaC is Not a CAS), eg.
bash:~$ curl -s -S ftp://ftpthep.physik.uni-mainz.de/pub/GiNaC/ginac-1.4.0.tar.bz2 \
-o ginac-1.4.0.tar.bz2
- Unpack the downloaded library and change into the directory that has been created, eg.
bash:~$ tar -xjf ginac-1.4.0.tar.bz2
bash:~$ cd ginac-1.4.0
bash:~/ginac-1.4.0$
- Configure, compile and install the library to the directory <Octave.app>/Contents/Resources specified by the flag --prefix, eg.
bash:~/ginac-1.4.0$ PATH=/usr/local/bin:/Applications/Octave.app/Contents/Resources/bin:{$PATH} \
./configure --prefix=/Applications/Octave.app/Contents/Resources \
CFLAGS="-I/Applications/Octave.app/Contents/Resources/include" \
LDFLAGS="-L/Applications/Octave.app/Contents/Resources/lib"
bash:~/ginac-1.4.0$ PATH=/usr/local/bin:$PATH make && make install
- Startup Octave.app and install the desired Octave–package, eg.
octave-2.9.12:1> pkg install symbolic-1.0.3.tar.gz
How can I install the Arpack–package from Octave–Forge that also depends further libraries?
Note: Octave.app version 3.2.0 or newer are bundled with the Arpack library and the Arpack package. The Octave command eigs
and others are directly included within Octave.app, therefore there is
no need to install the Arpack–package from Octave–Forge anymore.
Note: this example leans against the installation of the package arpack-1.0.2.tar.gz
and an Octave.app version 2.9.16. There may be newer versions of the
ARPACK–sources, Octave.app and the Octave–Forge arpack–package
available at the download sites.
As described previously you need to download, configure,
compile and install the needed ARPACK–software before you install the
Octave–Forge package.
- Download a current version of the ARPACK–software and the patch that is available, eg.
bash ~$ curl -s -S http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.Z \
-o arpack96.tar.Z
bash ~$ curl -s -S http://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.Z \
-o patch.tar.Z
- Unpack the downloaded files, patch the codes and change into the directory that has been created, eg.
bash:~$ tar -xzf arpack96.tar.Z
bash:~$ tar -xzf patch.tar.Z
bash:~$ cd ARPACK
bash:~/ARPACK$
- Edit the file ARmake.inc and change the values of the following variables in a similar way, eg.
# this is the location of your current ARPACK directory that has been created
home = $(HOME)/ARPACK
# this actually only results in the name of the created libarpack_${PLAT}.a
PLAT = MAC
# use backslashes without spaces here and use tabulators at the beginning of the lines
FC = PATH=/Applications/Octave.app/Contents/Resources/bin:${PATH}\
/Applications/Octave.app/Contents/Resources/bin/fort77\
-I/Applications/Octave.app/Contents/Resources/include
# remove the option -cg89 that is not compatible with fort77
FFLAGS = -O
# make is in the directory /usr/bin not in /bin
MAKE = /usr/bin/make
- Compile the ARPACK–software and change the name of the created static library libarpack_MAC.a into libarpack.a. Then move the renamed static library into the lib directory of Octave.app, eg.
bash:~/ARPACK$ make lib
bash:~/ARPACK$ mv libarpack_MAC.a libarpack.a
bash:~/ARPACK$ mv libarpack.a /Applications/Octave.app/Contents/Resources/lib
- Startup Octave.app and install the desired Octave–package, eg.
octave-2.9.16:1> pkg install arpack-1.0.2.tar.gz
Developer FAQ
How can I build my own Octave.app from scratch?
Please consider adapting the Octave.app build scripts at http://octave.sourceforge.net in the directory admin/MacOSX/Octave.app.
Can I upgrade Octave.app from sources of the current development snapshot?
Yes, the idea was to create a script file for Octave developers that
compiles the current sources of Octave and overwrites all binaries
within Octave.app (eg. this way you can create a gdb–version of
Octave). Carefully read the comments in the file selfupdate.sh from the Octave–Forge SVN before you try to update your Octave.app and also please keep the email traffic on the mailing–list octave-dev@lists.sourceforge.net about “it doesn't work” small.
Are there any other Octave Mac OS X open topics where I could help?
Yes, in general most Octave developers are subscribed to all of the
Octave and Octave–Forge mailing–lists. You'll find open threads there
and discussions about the ongoing work of GNU Octave. Currently there
are the following open topics:
- Help is needed to port the Octave–Forge package Java and the package JHandles to Mac OS X (they currently don't work with any of Mac's binary versions of Octave). Read about some started discussions here
http://www.nabble.com/Need-for-JHandles-Linux-tester-tf4017520.html#a11480385
and also talk to the maintainer of these packages about “what tests should be done” and “how you can help porting the codes”.
- Other
packages from the Octave–Forge project can not be installed because of
reason <XYZ>. You must understand that it is quite a lot of work
to pack Octave.app and to keep every new version of Octave.app
up–to–date and keep it running for the various Mac OS X platforms.
Building and installing packages from the Octave–Forge website is
independent from building Octave.app, ie. if you have the time to
answer Mac OS X dependent questions about Octave–Forge packages then
please join the octave-dev@lists.sourceforge.net
mailing–list. Further, if you actively want to help keeping the
packages installable and running with Octave.app then please join the
Octave–Forge Development team. Thanks in advance!
- The Octave–Forge packages Optiminterp and Spline-gcvspl
cannot be installed with Octave.app because of the Fortran90 code
files. If you want to help making these packages available then maybe
it would be an idea to talk to the maintainers of these two packages if
it would be possible in general to backport the F90 code files into F77
code files though that these packages can also be installed on even
more platforms like Octave.app. The other idea might be to set up a
Fortran compiler for Octave.app that can handle F90 code files.
Note: Octave.app versions 3.2.0 or newer are bundled with a g95 Fortran compiler instead of fort77 and f2c. This problem only exists for Octave.app versions 3.0.x or older.
Help
Bugs, enhancements, help and other stuff about the binary Octave.app
are debated on the Octave-Forge mailing list. It's a fairly low-trafic
list, and you are most welcome to join. You can subscribe to the list
by going to the listinfo page. You can also access the archives for this list at the mail archive.
A lot of the people on the Octave-Forge mailing list are also subscribed to the GNU Octave mailing lists, so you might want to joing those lists as well. You can access a searchable archive for these lists at Nabble.
If
you find out that a specific function of GNU Octave is not doing the
right thing then please file a bug report by calling the command bug_report in GNU Octave and send that bug report to bug-octave@octave.org.