Installing MacOS X Bundle
Introduction to the Bundle Installing Octave on a mac should be a breeze since is there a nice bundle that's easily downloaded and contains everything that you will need . But there's a lot of new users that run into problems, and for good reason. If you are a mac user and are suddenly faced with installing stuff that requires you to delve into the bowels of your computer for the first time (or even the second or third) - it can be mighty intimidating and success can be illusive. This writer knows first hand. So this is largely for those at the low end of the experience spectrum, although there may be some tips that help the power user community if they have need to make Octave work in the mac world. I hope so, because the things they contribute certainly help me out a lot.
As you probably know, Octave is a numerical computation software platform. It can calculate just about anything that you can imagine. But if you want to see the results graphically, you need a plotting system to make that happen. That's another application called Gnuplot. Gnuplot takes output from Octave and plots it in windows on your screen - or sends it off to print or whatever you want to do. This requires a windowing system - (now we're getting a bit closer to the bowels) - and the most common one is X11. This is installed by default on OS X 10.5 and above. However many mac users prefer the appearance of another windowing system - Aquaterm. So this part of the wiki helps you to install Octave and make it plot your results through Gnuplot using the Aquaterm windowing system. At the end I'll try and deal with some of the issues that arise during installation that might make it seem like 'it just doesn't work'.
Let's do it The following is current as of 20120105. The installation process has been confirmed on an iMac running OS X 10.6.8 that has never previously had octave or gnuplot installed.
Download this binary (octave-3.4.0-i386.dmg) at:
It's the latest version of octave for which an OS X binary is available.
Mount (double click) the dmg.
Look in the 'Extras' folder and find a gnuplot-4.4.3-aqua-i386.dmg disc image.
This is a nice OS X binary of an up to date version of gnuplot and, ironically, may be the only place such a gnuplot binary exists for OS X. As an added bonus this gnuplot package includes and relies on Aquaterm the windowing system that many Mac users feel produces more elegant plots than X11.
Mount (double click) this dmg.
Move the 'Gnuplot' icon to your Applications folder. For purpose of this discussion - this is assumed to be /Applications. If you are using a local Applications folder (/~/Applications) appropriate modification of the paths specified below will be necessary.
At this point, Aquaterm is now also installed. It is located at /Applications/Gnuplot.app/Contents/Resources/lib/Aquaterm.app If you need it for some other application, this is the path that will find it. But don't move it to the upper level of the Applications folder - gnuplot will be looking for it where it self-installs. (To inspect the contents of an .app right click or control-click on it and select 'show package contents')
Move the 'Octave' icon from the first .dmg to the same folder (/Applications). It is strongly suggested that gnuplot be installed before octave.
Now you have everything you need to run octave+gnuplot+aquaterm. You can put the octave and gnuplot icons in the dock and either will open in a terminal window with a simple 'click'. To test octave, click its icon, and the octave prompt should appear in a new terminal window along with some splash screen information. Then type 'sombrero(24)' at the octave prompt and after a while aquaterm should open and the multicolor sombrero plot should appear.
Problems, problems, problems ........
If you did all of the above and there is no result, most likely you got the octave prompt, typed the 'sombrero(24)' test, but no plot showed up. You probably got some error message that included the line 'sh: gnuplot: command not found'. This means (surprise, surprise) that octave couldn't find gnuplot in order to pass on the plot information. We can fix that, but it requires some unix magic on the command line. We are going to create 'dummy' applications at a location where OS X will search and be sure to find them. Open a new terminal window (/Applications/Utilities/Terminal) and do (ignoring the # comments):
> sudo touch /usr/bin/gnuplot # creates an empty 'dummy' gnuplot file in directory /usr/bin which is included in most PATHs. sudo invokes the 'superuser' or administrator and will ask for a password .... then:
> ln -s /Applications/Gnuplot.app/Contents/Resources/bin/gnuplot /usr/bin/gnuplot #creates a link between the binary in the app in your Applications folder and the new dummy gnuplot file (in the bowels).
> touch /usr/bin/octave # while we're at it, may as well do the same thing for octave
> ln -s /Applications/Octave.app/Contents/Resources/octave /usr/bin/octave # this is a good way of inserting octave in your PATH so it can be started from the command line
Now to make sure that /usr/bin is in your path do:
this should produce several lines of text in response including something like : PATH=/opt/local/bin:/opt/local/sbin:/usr/local:/bin:/sbin:/usr/bin:/usr/sbin:/usr/texbin:/usr/local/bin -- check to see that /usr/bin: is included
If it is, octave and gnuplot should work fine now. If not, we need to go to the .bashrc file. This is a(n invisible) file that sets things that are important to you up every time you open a new terminal window. Type this at the prompt:
> touch .bashrc # creates .bashrc file if one doesn't exist; > open .bashrc # opens it in your editor (probably Textedit)
type this in the editor:
PATH=$PATH:/usr/bin; export PATH
save and close
Things should work now ....... Open a new terminal window and type 'octave' then 'sombrero(24)' at the prompt.
Starting octave from the command line requires these steps to inform bash (your shell) where the octave binary is located.
Some Other Solutions
There are other issues that come up that are largely a function of the way you have your system set up and, perhaps, what remnants of octave/gnuplot/aquaterm/X11 you have floating around in it. Following are things that might help when it just refuses to work.
Open .bashrc and add: export GNUTERMAPP=/Applications/AquaTerm.app; export GNUTERM=aqua
save and close