I didn't work on this rails app for a couple of weeks. Yesterday I got back to it, first opening the .dev URL (i'm using pow) and it gave this error message:
LoadError: dlopen([...]/vendor/bundle/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle, 9): Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib
Referenced from: [...]/vendor/bundle/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle
Reason: image not found - [...]/vendor/bundle/gems/sqlite3-1.3.7/lib/sqlite3/sqlite3_native.bundle
I checked the rbenv install and all seemed fine. I tried to think of recent changes that could lead to this but I can't. I'm pretty sure I'm missing something but my attempts to debug it were futile. I don't know if it's relevant but I recently switched to zsh.
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.7
1 gem installed
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With