Can't install mysql2 gem on macOS Sierra

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

    Here's what worked for me.

    Originally I ran:

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

    then

    $ bundle install
    

    I received an error in /Users/.../.bundle/ruby/2.5.0/extensions/x86_64-darwin-18/2.5.0/mysql2-0.5.3/mkmf.log :

    clang: error: unsupported option '--with-cppflags=-I/usr/local/opt/openssl/include'

    So I removed "--with-cppflags=-I/usr/local/opt/openssl/include"

    Then ran:

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

    followed by:

    $ bundle install
    

    Which worked.

提交回复
热议问题