DEV Community

Kaori Toki
Kaori Toki

Posted on

Installing a Niche Japanese Scientific Graph Tool on macOS Sequoia Was a Nightmare

Overview

I'm a freelance web engineer, and I recently started taking university courses to level up my skills.
One of the courses required me to use a tool called Ngraph-GTK — a scientific graphing software that's pretty popular in Japanese universities, especially in physics, chemistry, and engineering labs.

The instructions from the professor were basically: "Windows users, download it here. Mac users... figure it out yourself."

As a web engineer, I use a Mac. Pretty much every engineer I know uses a Mac.
So I figured I'd document the pain I went through, in case any other Mac-using engineers (or students) end up in the same situation.

Spoiler: it took way longer than it should have.

What is Ngraph?

Ngraph is a 2D scientific graphing tool originally developed by a Japanese developer, Satoshi Ishizaka.
It's designed for researchers, engineers, and students who need to plot data and create publication-quality graphs.

Graphs can be exported in PostScript, SVG, PNG, and PDF formats, which makes it handy for academic papers and lab reports.

The GTK-based version, Ngraph-GTK, is actively maintained on GitHub (htrb/ngraph-gtk) and runs on Linux, Windows, and macOS.

Outside of Japan, it's virtually unknown — tools like gnuplot or Python's matplotlib tend to dominate internationally.
But in Japanese universities, Ngraph is still widely used, especially in science and engineering courses.

If you're a Mac user who just got told to "install Ngraph" for a class, this post is for you.

Environment

Item Version
macOS 15.6.1 (Sequoia)
Xcode Command Line Tools 16.4.0
Homebrew 5.1.7
ngraph-gtk 6.09.11

Where Things Went Wrong (and How I Fixed Them)

1. Command Line Tools Error

First, I ran the standard install command:

brew install ngraph-gtk-launcher
Enter fullscreen mode Exit fullscreen mode

And got hit with this right away:

Error: Xcode alone is not sufficient on Sequoia.
Install the Command Line Tools:
  xcode-select --install
Enter fullscreen mode Exit fullscreen mode

Fair enough. I ran it:

xcode-select --install
Enter fullscreen mode Exit fullscreen mode

A popup appeared — clicked "Install", waited a few minutes, done.
Then I also accepted the Xcode license, which can silently block Homebrew builds:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
Enter fullscreen mode Exit fullscreen mode

To verify the CLT is properly installed:

xcode-select -p
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
Enter fullscreen mode Exit fullscreen mode

You should see /Applications/Xcode.app/Contents/Developer and the version number.


2. gmake Not Found

Back to the install. Same command, new error:

Error: Failed executing: gmake
Enter fullscreen mode Exit fullscreen mode

ngraph-gtk needs GNU make to build, which doesn't ship with macOS by default.
Install it via Homebrew and add it to your PATH:

brew install make
echo 'export PATH="$(brew --prefix make)/libexec/gnubin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

3. The -std=gnu23" Quote Bug (The Real Pain)

This is where it got interesting.

Running the install again, gmake failed with:

error: invalid value 'gnu23"' in '-std=gnu23"'
Enter fullscreen mode Exit fullscreen mode

Notice the stray " at the end of gnu23". That's not supposed to be there.

What's happening: the configure script correctly sets -std=gnu23, but when it gets written into config.status and libtool, a rogue " gets appended. Every time gmake runs, config.status regenerates libtool, so simply patching one file isn't enough — you need to fix both.

First, keep the temp build directory around so we can edit it:

HOMEBREW_KEEP_TMP=1 brew install ngraph-gtk
Enter fullscreen mode Exit fullscreen mode

It'll fail, but the temp directory will survive.
Check the directory name with ls /private/tmp/ and navigate into it:

cd /private/tmp/ngraph-gtk-xxxxxxxxx/
Enter fullscreen mode Exit fullscreen mode

Now patch config.status and libtool:

python3 -c "
with open('config.status', 'r') as f:
    content = f.read()
content = content.replace('S[\"CC\"]=\"clang -std=gnu23\"', 'S[\"CC\"]=\"clang\"')
with open('config.status', 'w') as f:
    f.write(content)
"

python3 -c "
with open('libtool', 'r') as f:
    content = f.read()
content = content.replace('CC=\"clang -std=gnu23\"', 'CC=\"clang\"')
content = content.replace('LTCC=\"clang -std=gnu23\"', 'LTCC=\"clang\"')
with open('libtool', 'w') as f:
    f.write(content)
"
Enter fullscreen mode Exit fullscreen mode

Verify the fix:

grep -rn 'gnu23"' .
Enter fullscreen mode Exit fullscreen mode

No output means you're good.


4. free_history_entry Undeclared Error

Past the quote bug, the next error showed up:

error: call to undeclared function 'free_history_entry'
Enter fullscreen mode Exit fullscreen mode

macOS ships with a BSD-flavored readline library, which doesn't have free_history_entry.
The fix is straightforward — patch src/shell.c directly:

sed -i '' 's/free_history_entry(entry)/free(entry)/g' src/shell.c
grep -n 'free_history_entry' src/shell.c
Enter fullscreen mode Exit fullscreen mode

No output from grep means the patch worked.

Now build and install:

gmake
sudo gmake install
Enter fullscreen mode Exit fullscreen mode

If it completes without errors, you're almost there.

The Clean Steps (TL;DR)

Skipping all the trial and error — here's what actually works:

① Install Command Line Tools and accept the Xcode license

xcode-select --install
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
Enter fullscreen mode Exit fullscreen mode

② Install gmake and add it to PATH

brew install make
echo 'export PATH="$(brew --prefix make)/libexec/gnubin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

③ Build ngraph-gtk, keeping the temp directory

HOMEBREW_KEEP_TMP=1 brew install ngraph-gtk
Enter fullscreen mode Exit fullscreen mode

It will fail. Check the temp directory name with ls /private/tmp/ and navigate into it:

cd /private/tmp/ngraph-gtk-xxxxxxxxx/
Enter fullscreen mode Exit fullscreen mode

④ Fix the quote bug

python3 -c "
with open('config.status', 'r') as f:
    content = f.read()
content = content.replace('S[\"CC\"]=\"clang -std=gnu23\"', 'S[\"CC\"]=\"clang\"')
with open('config.status', 'w') as f:
    f.write(content)
"

python3 -c "
with open('libtool', 'r') as f:
    content = f.read()
content = content.replace('CC=\"clang -std=gnu23\"', 'CC=\"clang\"')
content = content.replace('LTCC=\"clang -std=gnu23\"', 'LTCC=\"clang\"')
with open('libtool', 'w') as f:
    f.write(content)
"
Enter fullscreen mode Exit fullscreen mode

⑤ Fix free_history_entry

sed -i '' 's/free_history_entry(entry)/free(entry)/g' src/shell.c
Enter fullscreen mode Exit fullscreen mode

⑥ Build and install

gmake
sudo gmake install
Enter fullscreen mode Exit fullscreen mode

⑦ Verify it works

$(brew --prefix ngraph-gtk)/bin/ngraph
Enter fullscreen mode Exit fullscreen mode

The GUI should launch. 🎉

⑧ Add to PATH so you can just type ngraph

echo 'export PATH="$(brew --prefix ngraph-gtk)/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Wrapping Up

After all that, Ngraph-GTK is finally running on my Mac.

To summarize the two root causes:

  1. The -std=gnu23" quote bug: a build script issue where a stray " gets injected into config.status and libtool, causing the compiler to reject the flag on macOS Sequoia + Xcode 16.x
  2. free_history_entry undeclared: macOS uses a BSD readline library that doesn't include this function, unlike Linux

Both of these are bugs in ngraph-gtk itself, and I'm planning to report them as an issue on the GitHub repository. Hopefully this gets fixed in a future release so nobody else has to go through this.

If you're a Mac user who just wants to use Ngraph for a university course and ended up deep in build errors — I hope this saved you a few hours.

Happy graphing. 📈

Top comments (0)