Getting Octave to Just Goddamn Work Already on OS X 10.8 Mountain Lion

The So-Help-Me-God Edition

If you are in the fortunate position to be a lucky owner of a spiffy new Macbook, I salute you! In my humble opinion there could not be a finer breed of computer. Savor it, my friend!

However, if you are in the unfortunate position of needing to implement algorithms and plots in GNU Octave, I pity you. It is your fate to run through the gauntlet of Unix dependency hell that is getting open source software to work on a closed source operating system.

But I have good news! Hopefully, I have now exposed all the booby traps that Mountain Lion has set for you, and I've discovered the secret command-line incantations necessary to avoid them. Yes, much like Indiana Jones and the Last Crusade, I will now deftly disarm the traps so that you may pass freely into the chamber of the Holy Grail1. Choose wisely.


  1. First, install XQuartz. In the past this came installed on OS X, but as of Mountain Lion it is no longer included. So go fix that.
  2. You will also need the Xcode Command Line Tools if you don't already have them. Both Homebrew and XQuartz need this to work.
  3. Now you are ready to install Octave from Homebrew:2

    If you don't know what Homebrew is, then do me a favor and slap yourself a couple times. Install Homebrew now; thank me later.

Wow, Neil, that was easy! That's it, huh?
NO, YOU FOOL!

  1. Octave claims to have native drawing support using FLTK, but I haven't been able to get it working yet. We'll rely on gnuplot instead, which must be installed separately:
  2. Now edit your Octave startup file or create a new one:

    and add the line:
    (btw, to save and exit vim, type ':wq', or to exit without saving, type ':q')
  3. Now for the ultimate fix: reboot your machine! Yep, until you restart your Mac, Octave will be unable to launch XQuartz on its own, and you won't be able to plot anything.
  4. Once you're back in, open the terminal, fire up Octave, and plot a sombrero(). You're all set!

 


  1. The Holy Grail of Octave? Okay, not the greatest analogy.
  2. If you're having trouble with this step, see: Octave for OS X