库未加载:尝试运行 Rails 服务器并连接到 mysql 时 libssl.1.1.dylib (LoadError)
最近,我将 MacOS 更新到了 Monterey 12.3,其中包括 xcode 的更新。
之后我无法运行我一直在开发的 Rails 应用程序。当我尝试启动服务器时,我不断收到此错误。
我尝试过以不同的方式安装和删除 mysql。两者都使用来自mysql网站的brew安装和DMG文件。
我可以通过命令行访问数据库实例,但我认为他们的问题是我无法从应用程序连接。还有其他人有类似的问题吗?
这是完整的错误
/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
Recently I updated my MacOS to Monterey 12.3 which included updates for xcode.
After that I am not able to run the rails application that I have been working on. I keep getting this error when I try to spin up the server.
I have tried installing and removing mysql different ways. Both using a brew install and DMG file from mysql website.
I am able to access the database instance through my command line but I think they issue is that it I can't connect from application. Anyone else having similar issues?
here is the full error
/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
执行所有导出路径操作,并确保链接
[电子邮件受保护]
Do all the export path things, and make sure to link
[email protected]
如果有人遇到这个问题,这就是解决我的问题的方法。
需要更新
openssl
的路径。gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/[电子邮件受保护]/lib --with-cppflags=-I/opt/homebrew/opt/[电子邮件受保护]< /a>/include
bundle install
显然这是用于 openssl 安装
brew 安装
版本 1.1If anyone runs into this problem, this is what solved my issue.
paths to
openssl
needed to be updated.gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/[email protected]/lib --with-cppflags=-I/opt/homebrew/opt/[email protected]/include
bundle install
Obviously this is for openssl install with
brew install
version 1.1我能够让它工作:
I was able to get it working with this:
我对 postgresql 也有类似的问题,它在运行 psql -d 数据库时引发错误:
在我的情况下,我有 openssl@3 和 openssl@ 解决方案是:
然后用自制程序重新安装 postgresql。
我还让我的 zshrc 导出以下 ENV 变量,尽管我不太确定它是否相关:
对于遇到与我相同问题的人!
I had similar issue with postgresql, which raises error while running
psql -d database
:In my case which I have openssl@3 and openssl@ the solution is:
Then reinstall postgresql with homebrew.
I also had my zshrc exporting the following ENV variable though I'm not quite sure if it's related:
For someone who runs into the same issue as mine!
重新安装openssh后才可以使用。然后我仔细检查了
/usr/local/opt
是否存在无效链接并修复了它们。got it working only after reinstalling openssh. Then I double-checked the
/usr/local/opt
for invalid links and fixed them.