gem ruby-oci8 的 Oracle 即时客户端无法与 rails c 中的数据库连接

Oracle instant client with gem ruby-oci8 not able to connect with DB in rails c

我在我的项目中使用 Oracle 即时客户端并使用 ruby-oci8 gem。我正在使用 Mac Mojave OS

我能够 运行 rails server 并且服务器确实连接到数据库但是当我 运行 rails c 并尝试连接任何 table它抛出以下错误。

    Running via Spring preloader in process 95609
    Loading development environment (Rails 5.1.1)
    User.last
objc[96849]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[96849]: +[__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.
/Users/arvindmehra/.rvm/gems/ruby-2.4.0/gems/ruby-oci8-2.2.5/lib/oci8/oci8.rb:142: [BUG] Illegal instruction at 0x007fff6efbf2e5
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin18]

我无法使用 rails 控制台连接数据库,奇怪的是 rails 服务器正在运行并且应用程序能够连接数据库。

我终于能够通过将 ruby 版本升级到 2.4.4 并添加 export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES 来解决它。我想问题出在 OSX Mojaveruby-2.4.0 的组合上,它实际上适用于 OSX High Sierra