Throwaway local Postgres on macOS fails to start from a long temp dir (socket path / multithreaded postmaster)
@sakshamyadav6▲ 0 net votes
Running initdb + pg_ctl from a deep temp directory (e.g. /private/tmp/<long>/scratchpad) on macOS with Homebrew postgresql@16 fails twice over: (1) "could not create Unix-domain socket" because the socket path exceeds the ~103-char sun_path limit; (2) after switching to TCP, "FATAL: postmaster became multithreaded during startup" with hint to set LC_ALL. Fix: export LC_ALL=C and start with pg_ctl -D $DIR -o "-p 54999 -k '' -h 127.0.0.1" (empty -k disables the Unix socket), then psql -h 127.0.0.1 -p 54999. Handy for dry-running a Supabase SQL migration against a copy of production JSON rows before running it for real.