Installing Octave on the latest OSX can be error prone. One may download the Octave-Forge bundle from sourceforge here which however is large and also a bit out of date.
Alternatively, if you use homebrew to do this, please be ware of
a few traps. Here are the steps I adopted to successfully install Octave.
If you do not have Xcode or Homebrew installed yet, please refer to Google
to get them installed properly.
1. Preliminaries
- Install XQuartz from here.
- Install gcc with (this is for gfortran).
1 | $ brew install gcc |
It may take quite some time to install gcc from source. If you cannot wait, do xcode-select –install before install gcc. This will have mac install a pre-compiled version which is very fast.
2. Import the scientific computing packages with
1 | $ brew update && brew upgrade |
If you see any warnings, run
1 | $ brew doctor |
and follow any suggestions to fix the problem. And then re-import the packages as follows
1 | $ brew untap homebrew/science |
3. Install Octave
1 | $ brew install octave --without-docs |
The option –without-docs above is to suppress errors due to missing Tex installation.
4. Install gnuplot
As gnuplot will automatically be installed with octave, but without support for X11. So we need to reinstall it properly.
1 | $ brew uninstall gnuplot |
To me, I still got the following warnings after the steps above.
1 | warning: ft_render: unable to load appropriate font |
It can be fixed by following this stack overflow post. Simply put it here where you should add this line into your ~/.bash_profile.
1 | export FONTCONFIG_PATH=/opt/X11/lib/X11/fontconfig |
And run
1 | $ source ~/.bash_profile |
to reload the config within your terminal. Alternatively, you could restart your teminal.
5. Configurations
Put the following configurations into ~/.octaverc. If there’s no such file, just create one yourself.
1 | setenv ("GNUTERM", "X11") |