Building LumoSQL on macOS
LumoSQL builds and runs on macOS. Tested on macOS 26 "Tahoe", Apple M4 Pro, Apple clang 21, Homebrew.
The recipe
Install the packaged dependencies. git is needed for its Perl bindings,
gpatch because Apple's patch is 2.0 and not-fork wants 2.5 or later, and
tcl-tk@8 because Tclx needs Tcl 8.6:
brew install tcl-tk@8 git gpatch pkgconf readline libsodium
Build Tclx from source against the Homebrew Tcl 8.6. Use the master branch:
at the time of writing the BCK-13016-tcl9-upgrade branch in that repository
is the same commit as master and does not build against Tcl 9 either.
git clone https://github.com/flightaware/tclx
cd tclx
./configure --with-tcl=/opt/homebrew/opt/tcl-tk@8/lib \
--prefix=/opt/homebrew/opt/tcl-tk@8 --exec-prefix=/opt/homebrew/opt/tcl-tk@8
make && make install
echo 'puts [package require Tclx]' | /opt/homebrew/opt/tcl-tk@8/bin/tclsh8.6 # prints 8.6
Build not-forking into your home directory. Apple's system Perl is used, so
installing into the system site_perl would need sudo; INSTALL_BASE
avoids that at the cost of one PERL5LIB entry:
fossil clone https://lumosql.org/src/not-forking not-forking.fossil
mkdir not-forking && cd not-forking && fossil open ../not-forking.fossil
perl Makefile.PL INSTALL_BASE=$HOME/.local && make && make install
Set the environment. Every variable here is needed, and the reason for each is
in the problem list below. Put this in a shell profile or in a Makefile.local
at the top of the LumoSQL checkout (Makefile.local is read by the top-level
Makefile if present, and is not checked in):
export PATH=/opt/homebrew/opt/tcl-tk@8/bin:$HOME/.local/bin:$PATH
export PERL5LIB=$HOME/.local/lib/perl5:$(brew --prefix git)/share/perl5
export PKG_CONFIG_PATH=$(brew --prefix readline)/lib/pkgconfig
export TCL=tclsh8.6
As a Makefile.local:
TCL := /opt/homebrew/opt/tcl-tk@8/bin/tclsh8.6
export PATH := /opt/homebrew/opt/tcl-tk@8/bin:$(HOME)/.local/bin:$(PATH)
export PERL5LIB := $(HOME)/.local/lib/perl5:/opt/homebrew/opt/git/share/perl5
export PKG_CONFIG_PATH := /opt/homebrew/opt/readline/lib/pkgconfig
Then, in the LumoSQL checkout:
make doctor
make build TARGETS="3.54.0 3.53.2+lmdb-0.9.35 3.54.0+lmdbv1-1.0 3.53.2+libdb-2026.10.7"
echo 'select sqlite_version();' | build/3.53.2+lmdb-0.9.35/sqlite3
make doctor knows about macOS: it reports a keg-only Homebrew library as OK
with the PKG_CONFIG_PATH line to add, searches the Xcode SDK for headers
Apple ships, checks that Perl can load Git, and prints macOS-specific hints
for Tclx and not-fork.
Summary of MacOS differences
MacOS differs from Linux and the BSDs in four ways:
- Homebrew does not package Tclx, and Tclx does not yet compile against Tcl 9,
the Tcl installed by Homebrew's
tcl-tkformula. - Apple's git does not ship the Perl
Gitmodule for not-fork, and Apple'spatchis too old for not-fork. - There is no
/usr/include, and Homebrew installs readline keg-only, so SQLite's configure andpkg-configneed assistance to find it. - Apple's linker rejects
-Wl,-sonameand-Wl,-rpath-link, and the dynamic loader ignoresLD_LIBRARY_PATH. /tmpis a symlink to/private/tmp, and when libdb is in use, SQLite's VFS reports that as an error.- macOS's allocator reuses freed heap faster than glibc, causing libdb's multiversion page to crash on VACUUM of an in-memory database.
- macOS does not have robust mutexes, so LMDB locks with POSIX semaphores and a killed writer blocks all other process until all of them close.