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
4
Answers
If 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.1I was able to get it working with this:
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!
Do all the export path things, and make sure to link
[email protected]