Install Octave on El Capitan – Step-by-Step macOS Guide

homebrewinstallmacosopen source

The new GNU Octave 4.0.1 was released March 23, 2016.
I would like to find some standard way to install it in El Capitan (mine OS X 10.11.3) because it has significantly better support in some functions than Matlab, discussed in the thread here.
I do brew search octave and get

homebrew/science/octave    Caskroom/cask/octave       Caskroom/cask/xoctave    

where one of the first two should be a correct one.
The project's homepage support for OS X is down here about installing Octave on OS X systems.
There is also ruby's way of installing Octave described in the thread How to install Octave on OS X (Yosemite) but for Yosemite.
I would like to find some standard way of getting Octave for OS X.

I do successfully brew update and brew upgrade before the commands.
My Homebrew is 0.9.5 (git revision 80d1; last commit 2016-03-24).
user1256923. I run brew info octave but I get

Error: No available formula with the name "octave"

How can you install Octave in some standard way for El Capitan?

Best Answer

Using MacPorts ( http://macports.org/ ), with insight from instructions at http://blog.hani-ibrahim.de/en/octave4-mac-os-x-el-capitan-install.html (as well as http://blog.hani-ibrahim.de/en/octave-mac-os-x-el-capitan-install.html and http://blog.hani-ibrahim.de/en/octave4-upgrade-via-macports.html) as well as the Octave wiki at http://wiki.octave.org/Octave_for_MacOS_X#MacPorts

It seems as though MacPort's default atlas variant doesn't play nice with Octave, and arpac and qrupdate also have issues with their default installion, needing specific "variants" to properly build. Basically to get all of Octave 4 running, I did:

sudo port install atlas +gcc5
sudo port install arpack -accelerate+atlas+gfortran 
sudo port install qrupdate -accelerate+atlas+gcc5
sudo port install octave -gcc5+gfortran-accelerate+atlas+docs+fltk+graphicsmagick+java-gui-metis-qtgui+app+qt4gui+sound

Probably some of the octave variant flags are unneeded for some people, but I went with the options suggested by hani-ibrahim.de and it works for me to get command line Octave up and running, as well as giving a nifty Octave.app in the /Applications/MacPorts directory.

If you need Java support with the Java variant (+java) as above, you probably need a JDK (Java Development Kit) to get the necessary command line suff for that magic to work, so go to ( http://www.oracle.com/technetwork/java/javase/index.html ) for a download. Maybe the smaller JRE (Java Runtime Environment) would be sufficient, but I have installed the full JDK. Omitting the (+java) flag removes this requirement.

I just tested it (2016/09/01) on Mac OS X 10.11.6 and was able to intall via MacPorts with no errors, ending up with atlas @3.10.2_2, arpack @3.3.0_3, qrupdate @1.1.2_4 and octave @4.0.3_0

On about 2016/12/05, with just the xcode command line tools installed (not the full XCode), I was able to use the above to install on macOS 10.12.1 Sierra: arpack @3.3.0_3, atlas @3.10.2_2, qrupdate @1.1.2_4, and octave @4.2.0_1. I initially was not able to get 4.2.0_0 installed, but 0_1 finally did. The installation ended with the warning "unless octave is run with –no-gui-libs, graphics_toolkit(“fltk”) will cause a crash" but I have not investigated this issue.