How to Fix gdbm Issue for Python 3.14.2 on pyenv

This post is for the documentation purpose. Looking back, most people would immediately find the solution before questioning all the other myriads of avenues of possibilities like I did. Long story short, fixing the problem wasn’t the issue. It was why it happened that boggled my mind.

During the installation of Python 3.14.2 through pyenv, I had a compile error. But the error message was unusual, in that I couldn’t understand how it was missing a database manager, let alone something 3.13 would have certainly used. The error message was: ./Modules/_dbmmodule.c:23:14: fatal error: 'gdbm-ndbm.h' file not found.

My knee-jerk reaction was to find out what broke the link. Turns out, nothing really did — Python 3.13 was still up and running. And even if it did, the fix was already too simple and straight forward to the point it didn’t matter to learn what or how it broke the link. Since I am on macOS, I simply reinstalled gdbm via brew: brew install gdbm. No doubt a similar action can be taken on Linux and Windows.

Again, I didn’t really have opportunity to dig into what produced the error message. The fix came out spontaneously — I wasn’t expecting it to actually fix it — so by the time it did, I only learned later that gdbm released issues were more prevalent in the early days of Apple Silicon. I’m not M1 nor am I running an outdated version of macOS (the machine is on Tahoe). It is solved, it’s just that I don’t know why caused it in the first place.

Leave a comment

Comments will be automatically closed after 30 days.