Back to list
macOS Sequoia でニッチな日本の学術グラフツール Ngraph をインストールしたのは地獄でした
Installing a Niche Japanese Scientific Graph Tool on macOS Sequoia Was a Nightmare
Translated: 2026/4/20 13:03:03
Japanese Translation
概要
フリーランスのウェブエンジニアであり、最近大学のカリキュラムを立ち上げてスキルアップに取り組んでいます。
Ngraph-GTK というソフトウェアは、特に日本の大学、特に物理学、化学、工学の研究室で非常に人気のある科学グラフソフトウェアです。
教授の指示は基本的には「Windows ユーザーはここからダウンロードしてね。Mac ユーザーは……自分で考えろ」というものです。
ウェブエンジニアとしては Mac を使っていますが、私の周りのエンジニアのほとんどが Mac を使っています。
spoiler:それよりはるかに長い時間を要しました。
Ngraph は、日本の開発者・磯坂聡によって最初に開発された 2D 科学グラフツールです。
グラフは PostScript、SVG、PNG、PDF の形式でエクスポートでき、学術論文や実験報告書に便利です。
GTK ベースの Ngraph-GTK は GitHub(htrb/ngraph-gtk)でアクティブにメンテナンスされており、Linux、Windows、macOS で動作します。
日本国外ではほとんど知られておらず、gnuplot や Python の matplotlib などが国際的に主流です。
もし Mac ユーザーとして、授業のために「Ngraph をインストールせよ」と言われた方のためです。
項目
バージョン
macOS
15.6.1 (Sequoia)
Xcode Command Line Tools
16.4.0
Homebrew
5.1.7
ngraph-gtk
6.09.11
まず、標準的なインストールコマンドを実行しました:
brew install ngraph-gtk-launcher
すぐにこのエラーに遭遇しました:
Error: Xcode alone is not sufficient on Sequoia.
Install the Command Line Tools:
xcode-select --install
充分です。実行しました:
xcode-select --install
ポップアップ表示されました——「Install」をクリックし、数分待ってから完了しました。
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
CLT が正常にインストールされているか確認:
xcode-select -p
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
/Applications/Xcode.app/Contents/Developer とバージョン番号が表示されるはずです。
gmake Not Found
インストールに戻り、同じコマンドを実行:
Error: Failed executing: gmake
ngraph-gtk は build するために GNU make が必要ですが、これは macOS にデフォルトで含まれていません。
brew install make
echo 'export PATH="$(brew --prefix make)/libexec/gnubin:$PATH"' >> ~/.zshrc
source ~/.zshrc
-std=gnu23" Quote Bug (The Real Pain)
ここが面白くなってきました。
再インストールを実行すると、gmake は以下のようなエラーで失敗しました:
error: invalid value 'gnu23"' in '-std=gnu23"'
gnu23 の末尾の余計な " がありませんでした。実際には存在していません。
何が起きているか:configure スクリプトが -std=gnu23 を正しく設定しますが、config.status と libtool に書き込まれる際、異常な " が付け加えられます。gmake ごとに config.status が libtool を再生成するため、単一のファイルを修正だけでは不十分——両方を修正する必要があります。
まず、一時的なビルドディレクトリを保持して編集できるようにします:
HOMEBREW_KEEP_TMP=1 brew install ngraph-gtk
失敗しますが、一時的なディレクトリが生き残ります。
ls /private/tmp/ に移動し、中に立ち入ります:
cd /private/tmp/ngraph-gtk-xxxxxxxxx/
config.status と 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)
"
修正を確認:
grep -rn 'gnu23"' .
出力がないなら大丈夫です。
free_history_entry Undeclared Error
クォートバグ以降、次のエラーが表示されました:
error: call to undeclared function 'free_history_entry'
macOS は BSD 風味のリナライブラリを持っており、free_history_entry を備えていません。
src/shell.c に直接:
sed -i '' 's/free_history_entry(entry)/free(entry)/g' src/shell.c
grep -n 'free_history_entry' src/shell.c
grep から出力がないならパッチが機能しました。
今ビルドとインストール:
gmake
sudo gmake install
エラーなしで完了すれば、ほぼ完成です。
全ての試行錯誤をスキップ——ここからです
Original Content
Overview
I'm a freelance web engineer, and I recently started taking university courses to level up my skills.
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.
Spoiler: it took way longer than it should have.
Ngraph is a 2D scientific graphing tool originally developed by a Japanese developer, Satoshi Ishizaka.
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.
If you're a Mac user who just got told to "install Ngraph" for a class, this post is for you.
Item
Version
macOS
15.6.1 (Sequoia)
Xcode Command Line Tools
16.4.0
Homebrew
5.1.7
ngraph-gtk
6.09.11
First, I ran the standard install command:
brew install ngraph-gtk-launcher
And got hit with this right away:
Error: Xcode alone is not sufficient on Sequoia.
Install the Command Line Tools:
xcode-select --install
Fair enough. I ran it:
xcode-select --install
A popup appeared — clicked "Install", waited a few minutes, done.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
To verify the CLT is properly installed:
xcode-select -p
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version
You should see /Applications/Xcode.app/Contents/Developer and the version number.
gmake Not Found
Back to the install. Same command, new error:
Error: Failed executing: gmake
ngraph-gtk needs GNU make to build, which doesn't ship with macOS by default.
brew install make
echo 'export PATH="$(brew --prefix make)/libexec/gnubin:$PATH"' >> ~/.zshrc
source ~/.zshrc
-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"'
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
It'll fail, but the temp directory will survive.
ls /private/tmp/ and navigate into it:
cd /private/tmp/ngraph-gtk-xxxxxxxxx/
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)
"
Verify the fix:
grep -rn 'gnu23"' .
No output means you're good.
free_history_entry Undeclared Error
Past the quote bug, the next error showed up:
error: call to undeclared function 'free_history_entry'
macOS ships with a BSD-flavored readline library, which doesn't have free_history_entry.
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
No output from grep means the patch worked.
Now build and install:
gmake
sudo gmake install
If it completes without errors, you're almost there.
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
② Install gmake and add it to PATH
brew install make
echo 'export PATH="$(brew --prefix make)/libexec/gnubin:$PATH"' >> ~/.zshrc
source ~/.zshrc
③ Build ngraph-gtk, keeping the temp directory
HOMEBREW_KEEP_TMP=1 brew install ngraph-gtk
It will fail. Check the temp directory name with ls /private/tmp/ and navigate into it:
cd /private/tmp/ngraph-gtk-xxxxxxxxx/
④ 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)
"
⑤ Fix free_history_entry
sed -i '' 's/free_history_entry(entry)/free(entry)/g' src/shell.c
⑥ Build and install
gmake
sudo gmake install
⑦ Verify it works
$(brew --prefix ngraph-gtk)/bin/ngraph
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
After all that, Ngraph-GTK is finally running on my Mac.
To summarize the two root causes:
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
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. 📈