Rails, pow and Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib Rails, pow and Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib ruby-on-rails ruby-on-rails

Rails, pow and Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib


Solution

Uninstall and reinstall sqlite:

~/d/w/r/my-app git:master ❯❯❯ gem uninstall sqlite3                                                                      Successfully uninstalled sqlite3-1.3.7~/d/w/r/my-app git:master ❯❯❯ gem install sqlite3                                                                            Fetching: sqlite3-1.3.7.gem (100%)Building native extensions.  This could take a while...Successfully installed sqlite3-1.3.71 gem installed

What Happened

When the sqlite3 gem is installed, it builds a native component for talking to sqlite and so it links against the local sqlite3 libraries. This is all handled behind the scenes by gem. When that happens, it specifies the location of the library that it linked against.

Recently (January), the homebrew formula for sqlite became keg-only. Anything that was previously linked against sqlite referenced the homebrew version. You can check this by using otool -L:

~/d/w/r/my-app git:master ❯❯❯ otool -L /path/to/earlier/gem/sqlite3-1.3.6/lib/sqlite3/sqlite3_native.bundle/path/to/earlier/gem/sqlite3-1.3.6/lib/sqlite3/sqlite3_native.bundle:    /usr/local/lib/libsqlite3.0.8.6.dylib (compatibility version 9.0.0, current version 9.6.0)    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

Running otool against the new version you can see that it is now linked against the Apple-provided system sqlite libraries:

~/d/w/r/a/new-config git:master ❯❯❯ otool -L /path/to/new/gem/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle /path/to/new/gem/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle:    /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 9.6.0)    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)