How to install Octave via Homebrew in Mac OS X 10.10 Yosemite and later
From the machine-learning-scientific-and-plotting dept. (71186) (26) by Luis
Here is a very quick way to install octave with aquaterm on Mac OS X 10.10 a.k.a. Yosemite as well as 10.11 a.k.a El Capitan. Note that these steps are not for the feign of heart and your millage might vary... Follow at your own risk.
updated 2016-11-21 22:32 GMT - tested with macOS Sierra (10.12) works well
updated 2015-10-07 21:58 GMT - tested with El Capitan (10.11) works well
updated 2015-06-21 09:17 GMT - adds homebrew/science tap
updated 2014-10-24 05:15 GMT - includes MacTex
First things first
Before you start you need to get your system setup. You will need:
- install Xcode from Apple's dev site
- install Xcode command line utilities from Xcode add-ons
- install hombrew
- install AquaTerm from sourceforge
- install Mac Latex (MacTex) from tug.org
- (optional) install Java
Yep, note that I'm assuming that you already have a working Homebrew installation, compilers, and AquaTerm ready... Then you may do:
brew tap homebrew/science
brew reinstall gnuplot --with-aquaterm
gnuplot# make sure it says "terminal set to aqua"
brew install lua51# yes, you also need this old version of Lua
brew install octave
Installing Octave will take a while and it will install Lua 2.x as a dependency. If you see the
make check | tee make-check.log taking an extremely long time. You might have to open a new terminal and navigate to
cd /tmp/octave* and
cat make-check.log to see where it went wrong. In my case it used to stop while loading lua dynlib files but installing the older lua51 fixed it.
When updating your operating system to a newer version of MacOS (macOS now), you may need to reinstall Octave if you see an error like:
dyld: Library not loaded: /usr/local/opt/gcc/lib/gcc/5/libgfortran.3.dylib Referenced from: /usr/local/opt/arpack/libexec/lib/libarpack.2.dylib Reason: image not found octave exited with signal 6
brew reinstall gcc arpack. If that does not fix it, then try:
brew reinstall octave --without-arpack. And if this fails, you may use:
brew reinstall octave --with-java.
Leave a comment if you need help, but this should do the trick ;) Now you can move on with your Machine Learning studies!
Here is a quick way to know everything works correctly:
a = [2;3;4;5;6;3;4;32;3;2;1;4;5;6;7;]
b = [12;23;44;55;66;12;44;9;5;27;111;23;66;89;88;]
plot ([a, b])