skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.1


  2. I was able to get it working with this:

    brew install openssl
    
    bundle config build.mysql2 -- 
    --with-ldflags=-L/opt/homebrew/opt/[email protected]/lib
    --with-cppflags=-I/opt/homebrew/opt/[email protected]/include
    
    Login or Signup to reply.
  3. I had similar issue with postgresql, which raises error while running psql -d database:

    Library not loaded: '/opt/homebrew/opt/[email protected]/lib/libssl.1.1.dylib'
    

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

    brew install [email protected]
    brew link [email protected] --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/[email protected]/bin:$PATH"
    export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"
    export PKG_CONFIG_PATH="/opt/homebrew/opt/[email protected]/lib/pkgconfig"
    

    For someone who runs into the same issue as mine!

    Login or Signup to reply.
  4. brew install [email protected]
    

    Do all the export path things, and make sure to link [email protected]

    brew link [email protected] --force
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search