解决方案
卸载并重新安装 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
发生了什么
安装 sqlite3 gem 后,它会构建一个与sqlite对话的本机组件,因此它会链接到本地 sqlite3库。这一切都由gem在幕后处理。发生这种情况时,它会指定它链接的库的位置。
最近(1 月),sqlite的自制公式变成了 keg-only。之前与sqlite链接的任何内容都引用了自制版本。您可以使用以下方法检查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)
针对新版本运行otool
,您可以看到它现在与 Apple 提供的系统 sqlite 库链接:
~/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)