view etc/README.MacOS @ 15448:352349219529

Added multiline copy and execution to command history in IDE (bug #36884) * (history_dock_widget::ctxMenu) : New function. (history_dock_widget::handle_contextmenu_copy) : New function. (history_dock_widget::handle_contextmenu_evaluate) : New function. (history_dock_widget::history_dock_widget) : Connected popup menu to QListView. (history_dock_widget::handle_double_click) : Append <CR> to selected history to actually execute the command.
author John Swensen <>
date Thu, 27 Sep 2012 13:24:59 -0400
parents 494f9bac8862
children 6e834a113760
line wrap: on
line source

1. Easy to install Binary Releases

A MacOS bundle is available from sourceforge.

There are also Octave packages available from both Fink and MacPorts.  Each
of these package managers handle the details of compiling Octave from source.

2. Building from Source

Stable releases, development snapshots as well as the current developers
sources are available. The sources for stable releases are available from
the links below.

Development snapshots, intended for testing, are available from the link

Links to the stable releases, snap shots, and instructions for obtaining
the current development sources using mercurial can be found on Octave's 
web-site below.

Building on MacOS can vary significantly between versions.  These
instructions document the procedure for MacOS 10.6.X.

2.1 Developer's Tools

Apple's Xcode Developer's Tools must be installed to build Octave on MacOS X.

A fortran compiler is also required to build Octave.

AT&T Research provides versions of gfortran which have been patched to work
with gcc tool set bundled with Xcode.

Alternatively, the Fink and MacPorts package managers provide more recent
versions of gcc which include gfortan.  Those may be used to build the sources
as well.  However, care must be taken.

  * The same compiler must be used to build all all of Octave's sources.  This
    is necessary to avoid conflicts between the compiler libraries such as
    libstdc++.  For a successful build the first file in LDFLAGS must refer to
    this library.  For example, if building with gcc-4.5 obtained from MacPorts
    LDFLAGS would begin as,

      export LDFLAGS="/opt/local/lib/gcc45/libstdc++.6.dylib [...]"

  * As of MacOS 10.6.6, the 64-bit BLAS routines that are part of Apple's vecLib
    (framework accelerate) are not functioning correctly.  As a work around, an
    alternative BLAS/LAPACK library, such as ATLAS, must be used.  A bug report 
    has been filed with Apple.
      Title: "64 bit ABI issue with libBLAS.dylib"
      Problem ID: 7850167
      Date: April 11, 2010 at 12:04 AM

2.2 Manual Package Management

Instructions for building Octave are available on the web at the link below.

In addition, those wishing to build on MacOS X (10.6.x) should read section
2.1 above.

2.2.1 Critical Dependencies

The minimal dependencies needed to build Octave's snap-shots are listed below.

  * Xcode

  * Xcode-compatible gfortran: Available from

  * gnu sed: Available from

      ./configure --prefix=/usr
      sudo make install

  * gnu pcre: Available from
      The following build instructions will produce a universal binary,
      allowing both 32- and 64-bit code to link to pcre.  Whenever replacing
      libraries which came with the OS, it is necessary to compile them as
      universal binaries (even if you are only going to use one architecture)
      to avoid disrupting unrelated code which might also link to the library.

      export CFLAGS="-arch i686 -arch x86_64"
      export LDFLAGS="-arch i686 -arch x86_64"
      ./configure --prefix=/usr --disable-dependency-tracking
      sudo make install

  * flex: Available from

      ./configure --prefix=/usr
      sudo make install

  * blas/lapack

    - The Apple/Intel-provided BLAS works out of the box in 32-bit as long as
      the -ff2c flag is used.  Alternatively, a wrapper for Apple's vecLib
      framework may be used, enabling 64-bit.

A fully functional Octave requires additional dependencies.  Here is an example
 of how to compile one of them as a universal binary:

  * fftw3: Available from

      export F77="/usr/bin/gfortran"
      export CFLAGS="-arch i686 -arch x86_64"
      export FFLAGS="$CFLAGS"
      export LDFLAGS="$CFLAGS"
      ./configure --disable-dependency-tracking
      sudo make install
      make clean
      ./configure --enable-float --disable-dependency-tracking
      sudo make install

See the link below for additional details about optional dependencies.

TODO - Modify the configure script to test for 64 bit vecLib bug.  When the bug
       is present, apply the wrapper solution.

2.2.2 Building Octave as a 32-bit Application

The commands below are sufficient to build a 32-bit Octave.

  export FC="/usr/bin/gfortran"
  export CFLAGS="-m32"
  export FFLAGS="$CFLAGS -ff2c"
  export LDFLAGS="$CFLAGS"
  ./configure --disable-readline --disable-docs

Octave provides an integrated tests suite.

  make check

Octave may be run without installing the application using the utility below.


2.2.3 Building Octave as a 64-bit Application

The commands below are sufficient to build a 64-bit Octave.

  export FC="/usr/bin/gfortran"
  export CFLAGS="-arch x86_64"
  export FFLAGS="$CFLAGS"
  export LDFLAGS="$CFLAGS"
  ./configure --disable-readline --disable-docs

Octave provides an integrated tests suite.

  make check

Octave may be run without installing the application using the utility below.


2.3 Building With Dependencies Satisfied by Fink

To install and setup the Fink package manager see the on line documentation.

Currently, Fink does not have a package available for Octave versions above
3.0.x.  These instructions will allow the developers sources to be build and
run, but will not permit Octave to be installed in the usual Fink way.

TODO - When a Fink package is developed for Octave 3.4.x, modify these 
       instructions to model the MacPorts section.

2.3.1 Dependencies

To build Octave's sources the list of Fink packages below need to be installed.

  autoconf (>= 2.6.0)
  automake (>= 1.11)
  fftw3 (>= 3.1.1)
  fftw3-shlibs (>= 3.1.1)
  flex >= 2.5.30
  gnuplot (>= 4.2.6)
  graphicsmagick (<= 1.3.7)
  graphicsmagick-shlibs (<= 1.3.7)
  hdf5 (>= 1.6.5)
  hdf5-shlibs (>= 1.6.5)
  libtool >= 2.2.2 
  qrupdate [1]
  suitesparse (= 3.1.0-1 )

Some of Octave's dependencies are among the default packages for Fink.  These
include the list below, and possibly others as well.


For fully functional printing (graphics output), the following packages must
be installed.

  transfig [2]

[1] Fink does not yet have a package for qrupdate.  However, one is available
    in the tracker at the link below.

[2] Optionally the "xfig" package may be installed.

2.3.2 Building With Dependencies Satisfied by Fink

After installing each of the dependencies, the sources are compiled by
setting the proper environment variables and then following the standard build
sequence.  The following is an example set of variables for a 32-bit build
using gcc-4.2.  When building from the sources obtained from the Mercurial
archive, ./bootstrap must be run prior to ./configure.

  export FINK_PREFIX="/sw"
  export PREFIX="/usr/local/bin"

  export OPTFLAGS="-O2 -g"
  export LDFLAGS="-L$FINK_PREFIX/lib -L/usr/lib -m32"
  export CFLAGS="-I$FINK_PREFIX/include $OPTFLAGS -m32"
  export ACLOCAL_FLAGS="-I$FINK_PREFIX/share/aclocal"
  export PKG_CONFIG_PATH="$FINK_PREFIX/lib/pkgconfig"
  export PATH="$FINK_PREFIX/var/lib/fink/path-prefix-10.6/:$PATH"
  export PATH="$FINK_PREFIX/lib/flex/bin:$PATH"
  export CPPFLAGS="-I$FINK_PREFIX/lib/flex/include $CPPFLAGS"
  export LDFLAGS="-L$FINK_PREFIX/lib/flex/lib $LDFLAGS"
  export CC="gcc-4.2"
  export CPP="cpp-4.2"
  export CXX="g++-4.2"
  export F77="/usr/bin/gfortran-4.2"
  export FLIBS="-lgfortran -lgfortranbegin"
  export FFLAGS="-ff2c $OPTFLAGS -m32"
  export CPPFLAGS="$CPPFLAGS -I$FINK_PREFIX/include/freetype2 \
                             -I$FINK_PREFIX/include/qhull \

  ./configure --prefix=$PREFIX \
              --libexecdir='${prefix}/lib' \
              --with-blas="-Wl,-framework -Wl,vecLib"

Note: This approach to building Octave does not support "make install".

TODO - Develop a Fink package for Octave 3.4.x.

2.4 Building With Dependencies Satisfied by MacPorts

To install and setup the MacPorts package manager see the online documentation

Using MacPorts, two approaches are described.  The first describes how to build
and locally install Octave from a formal snapshot of the developer's sources or
from the developer's sources themselves.  This is intended to the casual Octave
developer, or for users who want to live on the bleeding edge.

The second describes an approach for building Octave which is intended for
active developers.  In this case, MacPorts is used to satisfy Octave's
dependencies, but MacPorts does not build Octave.  Further a direct install of
Octave is not possible (i.e., cannot "make install").

2.4.1 Building and Installing Octave

With MacPorts building the developer's sources is convenient.  MacPorts
includes a port file for octave-devel.  To build and run the most recent
development snapshots, enter the commands below.

  sudo port selfupdate
  sudo port install octave-devel

To build the developers sources in one's own way, or if MacPorts' version is
outdated, a custom port file can be added.  This requires setting up a local
port file repository (link below).

The octave-devel port file may be used as an initial starting point.  The port
file is accessible from the web at the link below.

It is also available locally at the location below.  The parameter ${prefix} is
corresponds to where MacPorts is install, which by default is "/opt/local".


If the Portfile is missing the dependencies, epstools, epstoedit, and transfig,
those should be installed manually or added to the Portfile. To install
manually, type the command below.

  sudo port install epstools epstoedit transfig

The local source tarball must be placed in the location below, where ${name}
and ${distname} are each specified in the port file.


2.4.2 Building for Active Development of Octave

To satisfy most of Octave's dependencies, first install the octave-devel port.

  sudo port selfupdate
  sudo port install octave-devel

Now uninstall the Octave port.

  sudo port deactivate octave-devel

This will remove Octave and leave its dependencies in place. Some additional
dependencies may be needed.

  sudo port install epstools epstoedit transfig

Octave may now be built from a local mercurial archive by typing the commands
below (these assume gcc-4.4 is installed by macports).

  export PREFIX=/opt/local
  export CC=/opt/local/bin/gcc-mp-4.4
  export CXX=/opt/local/bin/g++-mp-4.4
  export CXXCPP="/opt/local/bin/g++-mp-4.4 -E"
  export F77=/opt/local/bin/gfortran-mp-4.4
  export FC=/opt/local/bin/gfortran-mp-4.4
  export CXXFLAGS="-pipe -O2 -m64"
  export FFLAGS="$CXXFLAGS -D_THREAD_SAFE -pthread"
  export CFLAGS="$FFLAGS -lstdc++"
  export LDFLAGS=-L$PREFIX/lib
  export CPPFLAGS=-I$PREFIX/include
  export BLAS_LIBS="-lcblas -lf77blas -latlas"
  export LAPACK_LIBS=-llapack
  ./configure --prefix="/opt/local" --without-framework-carbon --with-x

Octave's integrated tests may be run.

  make check

"make install" should not be run as it will bypass the macports package 
management.  To run Octave, type the command below from the root of the
mercurial archive.


John W. Eaton

Ben Abbott

Last updated: Sat Feb 19 14:15:04 PST 2011