Rails
SQLite3
Rails5

Rails 開発中に active_record ライブラリ内で Segmentation fault が起きた

エラー内容

/Users/xxxxx/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/sqlite3_adapter.rb:30: [BUG] Segmentation fault at 0x00000000000110
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
c:0069 p:---- s:0378 e:000377 CFUNC  :initialize
c:0068 p:---- s:0375 e:000374 CFUNC  :new
c:0067 p:0183 s:0369 e:000368 METHOD /Users/xxxxx/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/sqlite3_ad
c:0066 p:0028 s:0361 e:000360 METHOD /Users/xxxxx/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/c
c:0065 p:0027 s:0357 e:000356 METHOD /Users/xxxxx/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/c
c:0064 p:0025 s:0353 e:000352 METHOD /Users/xxxxx/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/c

原因

原因はこいつだった
https://github.com/rails/spring/issues/493

/usr/bin/sqlite3を使っていることが原因のようだ。

解決策

brew でインストールした sqlite3 を使うようにした。

$ ln -sf ../Cellar/sqlite/3.20.1/bin/sqlite3 /usr/local/bin/