ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Catalina Ruby Error Threads

If you see this error after updating to Catalina, running rails c, and then trying to list a few active records:

+[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

The issue is that spring is doing unsafe threading.

So you can either turn off spring:

export DISABLE_SPRING=true

Or you can turn off the thread-safety check:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

As for me, I’ll turn of the thread-safety check for my development env.


You can find some more discussions on this topic:

https://bugs.ruby-lang.org/issues/14009

Had the same problem, I’ve tried the above solution and added this:

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

to ~/.zshrc and now its working fine for me.

However I was also able to run rails server successfully using webrick instead of puma on my local:

rails server -u webrick

Also please remember to restart your terminal after adding the above change.