Skip to content

ruby-pg SIGTERM and SIGABRT on Apple Silicon Macs

Posted on:November 17, 2025

Lately, while relentlessly working on my Ruby on Rails projects, I started encountering unexpected crashes after restarting my application server. The logs revealed that the Ruby process was terminating with SIGTERM (Segmentation fault).

pg/connection.rb:944: [BUG] Segmentation fault at 0x0000000122284b1e

What? First, there was a mismatch in the version of libpg and the Postgres version running in my Docker container. After fixing that, the problem persisted. After some digging, I found out that the issue was related to the pg gem and its compatibility with Apple Silicon Macs. Here is a related GitHub issue:

https://github.com/ged/ruby-pg/issues/538

This was easily fixed by putting following line into my ~/.zshrc file:

export PGGSSENCMODE="disable"

It was fine for a while, but then I got SIGABRT in SolidQueue worker processes with the following error message:

Process pid=31457 exited unexpectedly. Received unhandled signal 6

Bruh. I just want to write the code.

So I found another GitHub issue that mentioned a similar problem:

https://github.com/ged/ruby-pg/issues/538

The solution was to add another environment variable to my ~/.zshrc file:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY="yes"

Now everything works fine. No more crashes. I can write code in peace.