installing Octave for the Stanford Machine Learning class, I decided I should jot this down for posterity or anyone else in a similar position. This should give you a working Octave install that plays nice with Gnuplot. (Most of this comes from Octave’s wiki with help from a StackOverflow post or two.)
Instead of using the Octave installation package as recommended in the course notes (this results in the problems we’re trying to avoid), I’ll be installing Octave via Homebrew, which fixed a lot of my initial install problems.
If you haven’t already, you’ll need to install Xcode (free in the Mac App Store) and the Command Line Tools. Once you’ve installed Xcode, you can install Command Line Tools in Xcode > Preferences > Downloads.
You’ll also need to install XQuartz, so go ahead and download and install that now.
Next, open up a Terminal and do the following:
# install Homebrew http://brew.sh/ if you don't already have it ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" # tap the science formulae brew tap homebrew/science # install some Octave dependencies # the update/upgrade command below could take a while brew update && brew upgrade brew install gfortran # install octave brew install octave # install fltk for gnuplot brew install fltk # install gnuplot brew install gnuplot
Last, you need to edit your .octaverc file to get gnuplot to play nicely with Octave. So, in your home directory, create a new .octaverc file and paste the following:
# ~/.octaverc setenv ("GNUTERM", "X11") # below is optional; changes the prompt to two chevron # and gets rid of the long Octave x.x.x >> prompt PS1('❯❯ ')
I’m pretty sure that should get you up and running, but in case I missed a step, feel free to send me an email or a fix it for me.