0

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
ls168
  • 27
  • 1
  • 7

4 Answers4

2
brew install openssl@1.1

Do all the export path things, and make sure to link openssl@1.1

brew link openssl@1.1 --force
Gary Bao 鲍昱彤
  • 2,608
  • 20
  • 31
1

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/openssl@1.1/lib --with-cppflags=-I/opt/homebrew/opt/openssl@1.1/include

bundle install

Obviously this is for openssl install with brew install version 1.1

ls168
  • 27
  • 1
  • 7
1

I was able to get it working with this:

brew install openssl

bundle config build.mysql2 -- 
--with-ldflags=-L/opt/homebrew/opt/openssl@1.1/lib
--with-cppflags=-I/opt/homebrew/opt/openssl@1.1/include
Paul Schreiber
  • 12,531
  • 4
  • 41
  • 63
1

I had similar issue with postgresql, which raises error while running psql -d database:

Library not loaded: '/opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib'

In my case which I have openssl@3 and openssl@ the solution is:

brew install openssl@1.1
brew link openssl@1.1 --force

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:

export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"

For someone who runs into the same issue as mine!

JFree
  • 86
  • 4