Macos – Octave freeze when it needs to plot

gnuplotmacosoctaveplot

I have a problem ploting from Octave. Octave and Gnuplot are installed with Homebrew on OS X El Capitan, and after trying to do first plot, I got error:

set terminal aqua enhanced title "Figure 1" size 560 420 font
"*,6" dashlength 1

This problem is fixed using instructions from this answer, in short:

brew uninstall gnuplot

sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.dylib
sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/AquaTerm /usr/local/lib/libaquaterm.1.0.0.dylib
sudo ln -s /Library/Frameworks/AquaTerm.framework/Versions/A/Headers /usr/local/include/aquaterm

brew install gnuplot --with-aquaterm

echo '

Now, when I do plot, eg. plot(rand(3)), then Octave just freeze, so I have to do Control-C to abort. When I try to plot directly from Gnuplot and set term aqua, it works and I get plots. But in Octave, when I want to set term aqua or set term, it reports:

error: invalid conversion from string to real N-d array error: set:

expecting graphics handle as first argument

Also, I tried with:

echo -E "setenv('GNUTERM','X11')" > ~/.octaverc

but that did not help either. I think the problem is with graphics_toolkit, but I do not know how to resolve this.

octave:1> graphics_toolkit aqua

error: graphics_toolkit: aqua toolkit is not available

error: called from
graphics_toolkit at line 81 column 5

octave:2> graphics_toolkit fltk

error: graphics_toolkit: fltk toolkit is not available

error: called from
graphics_toolkit at line 81 column 5

Update

Accepted solution works up until version 4.2.0-rc2, so now check the update in the answer for more information.

Best Answer

I noticed when I enter command available_graphics_toolkits it only shows

ans =

{

[1,1] = gnuplot

}

and wheh I try with loaded_graphics_toolkits, it prints

ans = {}(1x0)

I guesed problem was with not loading GUI environment, so Octave was then recompiled with --with-gui option

brew reinstall octave --with-gui

and that solved a problem.

Update

According to this commit, from last September, version 4.2.0-rc2, --with-gui does not work anymore. So the best it to follow the instruction from Konstantin.