升级到 macOS Mojave,现在在 rails 控制台中出现错误

Are*_*fin 6 macos fork ruby-on-rails macos-mojave

两天前升级到莫哈韦沙漠。Rails 服务器正在运行,但是当我尝试运行 activerecord 内容时,出现错误。当我尝试运行“Account.last”或“Account.new”或其他任何东西时,它会将我踢出去并出现以下错误

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.
Run Code Online (Sandbox Code Playgroud)

红宝石 2.3.4

导轨 5.1.6

卸载了一些 gems 并尝试但同样的错误。这两天快死了 而且我不仅仅是升级后面临这个问题的人。

小智 5

把这个export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES放在你的~/.bash_profile

如果您使用 oh-my-zsh,请编辑~/.zshrc并将其放在 export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES文件开头

然后重新加载你的 zsh 配置$ source ~/.zshrc


小智 0

今天,一位同事在升级到 Mojave 后遇到了同样的问题。

从 unicorn-rails 切换到 puma服务器,问题得到解决。因此,为了继续日常工作,您可以将开发/测试中的服务器更改为 puma。

这不是永久解决方案,但有助于定位问题所在并畅通开发人员工作流程。