Mac High Sierra下Octave绘图遇Broken pipe及Qt终端通信错误求助
Hey there, let's work through this Octave plotting bug you're hitting on Mac High Sierra 10.13.3! The Qt terminal communication error: select() error 9 Bad file descriptor and subsequent broken pipe messages are super common with older Octave versions like 3.8.0, thanks to compatibility gaps between its Qt-based graphics terminal and the newer system IO layers in High Sierra.
Here are the most reliable fixes to try:
1. Switch to a More Stable Graphics Toolkit
The quickest fix is to ditch the problematic Qt terminal and use one of Octave's alternative graphics backends. Here's how:
- Open Octave and run this command first to switch the toolkit:
graphics_toolkit('gnuplot') % You can also try 'x11' if gnuplot doesn't work - Then re-run your plotting code (I fixed the tiny typo in your last
plotcall too):t = [0: 0.01: 0.98]; y1 = sin(2*pi*4*t); y2 = sin(2*pi*4*t); plot(t, y1); hold on; plot(t, y2, 'r'); figure(1); plot(t,y1);
This bypasses the Qt terminal entirely, so the communication pipe errors should disappear immediately.
2. Upgrade Octave to a Newer Version
Octave 3.8.0 is a pretty old release (from 2014), and the Qt terminal bugs you're seeing were fixed in later updates. Upgrading will not only resolve this issue but also give you access to better performance and new features:
- If you use Homebrew, you can install a newer version with:
brew install octave - If Homebrew has trouble with High Sierra, you can grab a pre-compiled installer compatible with 10.13.3 from the Octave official distribution channels.
3. Check Qt Dependencies (Advanced)
If you absolutely need to stick with Octave 3.8.0, you can verify that your system has the correct Qt libraries installed (Octave 3.8.0 typically relies on Qt 4.x). However, this is a more involved process and doesn't guarantee a fix, so it's only recommended if the first two options aren't feasible.
内容的提问来源于stack exchange,提问作者Krishna

