Can't install mysql2 gem on macOS Sierra

后端 未结 12 2057
抹茶落季
抹茶落季 2020-12-23 13:21

I\'m setting up my development environment in the new macOS Sierra .

First of all, I installed Rbenv, Ruby (2.3.1)

相关标签:
12条回答
  • 2020-12-23 13:58

    I am here to share my fix, since the other answers didn't work.

    For my environment, I need MySQL 5.6 so I had to use:

    brew install mysql56 instead of brew install mysql

    Bundle installing the mysql2 gem kept failing, until:

    brew link mysql56

    I also ran afterwards:

    mysql.server start

    The last step might be unnecessary, but just in case.

    0 讨论(0)
  • 2020-12-23 13:58

    First, you should try 2 answer in here If you installed openssl but it still don't work. You should try to o refresh gems reference. A got the same issue and it worked for me.

    gem source -r https://rubygems.org/

    gem source -a https://rubygems.org/

    0 讨论(0)
  • 2020-12-23 14:02

    So I ran into this similar issue and for me it turned out to be a wrong ruby version and incompatible MySQL version. I use ruby 2.3 on most of my projects but inherited a 2.1 project. Changing to rvm to use 2.1 got me a little further.

    Then I found this: https://github.com/brianmario/mysql2/issues/603 that said you had to use mysql2 gem version greater than 0.3.17 with MySQL version 5.7

    Updated gem to 0.3.17 and it fired right up. Hope this helps someone.

    0 讨论(0)
  • 2020-12-23 14:04

    If none of the above works .. like in my case, doing this solved the issue brew install openssl

    FYI: i am using MacOS Catalina

    0 讨论(0)
  • 2020-12-23 14:06

    Try installing xcode-select --install

    0 讨论(0)
  • 2020-12-23 14:08

    I just had the same problem, tried all of the solutions listed above, then commenced to bang my head against they keyboard for a couple of hours.

    I then thought to try and install/reinstall the Xcode Command Line Tools:

    xcode-select --install
    

    Once I did that the mysql2 gem installed w/ no problems. I hope that does the trick!

    0 讨论(0)
提交回复
热议问题