Fix a Ruby pg Segfault on macOS When Running Rails Tests in Parallel

I use minitest to run parallel tests with bin/rails test on GemChat (Rails 8.1, Ruby 4.0.7, pg 1.6.3, PostgreSQL in Docker).

Running the Rails test suite in parallel should make it faster.

Instead, on my Mac, it made Ruby segfault:

❯ bin/rails test
≈ tailwindcss v4.3.3
Done in 134ms
Running 838 tests in parallel using 10 processes
Run options: --seed 8608
# Running:
/Users/zoras/.local/share/mise/installs/ruby/4.0.7/lib/ruby/gems/4.0.0/gems/pg-1.6.3-arm64-darwin/lib/pg/connection.rb:944: [BUG] Segmentation fault at 0x0000000124e34971
ruby 4.0.7 (2026-09-15 revision 229531a6cf) +PRISM [arm64-darwin25]

The parent process never stopped. It used 0% CPU and ignored everything except Ctrl+C. Serial runs with PARALLEL_WORKERS=1 always passed. For months, the workaround was “do not use parallel mode on macOS.”