Build bd Static
Use Homebrew as the default install path:
brew install beads brew upgrade beads
Use this skill only when Homebrew is unavailable, or when the packaged bd is not enough because you need a self-contained binary that avoids shared-library issues (for example ICU version mismatches across machines).
bd upgrade is not the installer path here; it reviews version changes but does not replace the binary.
Usage
/build-bd-static
Steps
- •
Check current version:
bashbd --version 2>/dev/null || echo "bd not installed"
- •
Find the latest available version:
bashgo list -m -json github.com/steveyegge/beads@latest 2>&1 | grep '"Version"'
- •
If already on the latest version, report that and stop. Otherwise, proceed to build the static fallback binary.
- •
Build the latest version statically with CGO disabled:
bashCGO_ENABLED=0 go install github.com/steveyegge/beads/cmd/bd@latest
@latestresolves at install time, so there's no need to pass the version from step 2 — that step is just for the "already on latest?" gate.CGO_ENABLED=0forces pure-Go alternatives for all dependencies (ICU regex, SQLite, etc.), producing a binary with zero shared library dependencies.macOS warning:
CGO_ENABLED=0can cause crashes (e.g., duringbd init) due to CGO/SQLite incompatibilities on macOS. macOS users should useCGO_ENABLED=1instead — see upstreamdocs/INSTALLING.mdfor details. - •
Verify:
bashbd --version # Linux: ldd "$(which bd)" 2>&1 # Should say "not a dynamic executable" # macOS: otool -L "$(which bd)" # Should show no external library entries
Why static?
The bd binary uses go-icu-regex (CGo) which links against the system's ICU library. Different machines have different ICU versions (e.g., Homebrew's icu4c@77 vs system libicu76), causing runtime failures:
bd: error while loading shared libraries: libicui18n.so.77: cannot open shared object file
Static compilation eliminates this entirely.