rake db:migrate error with mysql2 gem - Library not loaded: libssl.1.0.0.dylib

后端 未结 6 1924
死守一世寂寞
死守一世寂寞 2020-12-30 08:22

Getting the following error after running rake db:migrate

rake aborted!
LoadError: dlopen(/Users/scott/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-         


        
相关标签:
6条回答
  • 2020-12-30 08:36

    So the answer to my own question was the following - out of the 5 or so other solutions on stackoverflow, this is the only one that worked:

    brew install openssl
    
    cd /usr/local/Cellar/openssl/1.0.1f/lib
    
    sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/lib/
    

    Full solution here - https://mithun.co/hacks/library-not-loaded-libcrypto-1-0-0-dylib-issue-in-mac/

    0 讨论(0)
  • 2020-12-30 08:39

    Following fix solves the issue

       ==> cd /usr/local/Cellar/openssl/1.0.2s/lib/
    
    ==> sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib
    
    0 讨论(0)
  • 2020-12-30 08:39

    For users of rbenv:

     brew uninstall openssl
     brew install rbenv/tap/openssl@1.0
    
     gem uninstall mysql2
     gem install mysql2 -v '0.4.10' -- --with-opt-dir="$(brew --prefix rbenv/tap/openssl@1.0)"
    
    0 讨论(0)
  • 2020-12-30 08:47

    First uninstall the mysql2 gem:

    gem uninstall mysql2
    

    Make sure you installed openssl:

    brew install openssl
    

    It will print out some notes. We are interested in this part:

    For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
    

    Then you can re-install mysql2 gem like this:

    gem install mysql2 -v 0.4.10 -- --with-cppflags=-I/usr/local/opt/openssl/include --with-ldflags=-L/usr/local/opt/openssl/lib
    

    You should be good to go.

    0 讨论(0)
  • 2020-12-30 08:52

    just one command:

    gem pristine mysql2

    then i fix this problem

    0 讨论(0)
  • 2020-12-30 08:56

    In my case just uninstalling and installing the mysql2 gem did the trick

    $ gem uninstall mysql2
    
    $ bundle install 
    > Fetching mysql2 0.4.10
    > Installing mysql2 0.4.10 with native extensions
    
    0 讨论(0)
提交回复
热议问题