Can't install mysql2 gem on macOS Sierra

后端 未结 12 2095
抹茶落季
抹茶落季 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 14:12

    Almost the same scenario as @Caio Tarifa, Ruby 2.3.3, mysql 5.6 and mysql2. Tried on couple of solutions above and finally make it work with @kylekeesling's approach.

    First, tried on solution 1 by @spickermann:

    brew reinstall openssl && brew link openssl --force
    

    Nothing happened, same error shown.

    Second, tried on solution by @Alessandro Berardi:

    bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
    

    This got different but more errors since it overwrite gem extension's config so all gem extension installation failed.

    Finally, tried on @kylekeesling solution:

    xcode-select --install
    

    It fix mysql gem issue as well as nikogiri. Since I already intall Xcode, in my case it's reinstall the Xcode Command Line Tools.

提交回复
热议问题