Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgraded to macOS Mojave and now getting error in rails console

Upgraded to Mojave two days ago. Rails server is running but when I try to run activerecord stuff, I get error. When I try to run "Account.last" or "Account.new" or anything, it kicks me out and giving me following error

objc[38551]: +[__NSPlaceholderDictionary initialize] may have been in 
progress in another thread when fork() was called.
objc[38551]: +[__NSPlaceholderDictionary 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.

Ruby 2.3.4

Rails 5.1.6

Uninstalled few gems and tried but same error. It's killing me for last two days. And I am not only one facing this issue after upgrading.

like image 332
Arefin Avatar asked Oct 23 '18 04:10

Arefin


2 Answers

put this export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in your ~/.bash_profile

if you're using oh-my-zsh, edit ~/.zshrc and put this export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES at the beginning of file

and then reload your zsh config $ source ~/.zshrc

like image 85
dmrlps Avatar answered Oct 19 '22 22:10

dmrlps


Are you using Postgres?

I started getting this error when running puma in cluster mode (specifying workers) after moving to a new computer (running macOS Catalina). The issue seemed to be a result of my psql version. OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES bundle exec rails s puma did work but I was not satisfied since everything was working without that env variable.

I moved my psql version from 12 to 9.5 and rebuilt the pg gem and it fixed the issue without the env variable:

brew uninstall postgres
brew install [email protected]
brew link [email protected] --force
gem uninstall pg
bundle install
like image 1
Jose Castellanos Avatar answered Oct 19 '22 21:10

Jose Castellanos