Reputation: 15022
My Mac OS system is Majove.
Got below exception and none of below commands could make it work.
12163 bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"
12166 gem install mysql -- \ --with-mysql-config=/usr/local/bin/mysql_config
12167 brew install mysql-connector-c
12168 gem install mysql2 -- \ --with-mysql-config=/usr/local/mysql/bin/mysql_config
12169 gem install mysql2 -- --with-mysql-dir=/usr/local/opt/mysql/
12172 brew install openssl libyaml libffi
12173 RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local rbenv install 2.4.3
12184 RUBY_CONFIGURE_OPTS=--with-openssl-dir=/opt/local rbenv install 2.3.7
12194 gem install mysql2 -v '0.5.2' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
12195 bundle config build.mysql2 --with-opt-dir=/usr/local/opt/openssl
12196 gem install atomic
12197 brew install libiconv && xcode-select --install
12198 bundle config build.mysql2 --with-opt-dir=/usr/local/opt/openssl
checking for rb_wait_for_single_fd()... yes
checking for -lmysqlclient... no
-----
mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/poc/.rbenv/versions/2.4.3/bin/$(RUBY_BASE_NAME)
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
Upvotes: 1
Views: 92
Reputation: 15022
I found this solution fixes my problem https://medium.com/@konole/tough-love-between-mysql2-ruby-gem-and-macos-mojave-2cb6d389ab16
brew tap frnhr/homebrew-mariadb-connector-c-2
brew install frnhr/mariadb-connector-c-2/mariadb-connector-c
env ARCHFLAGS="-arch x86_64" gem install mysql2 -v '0.3.20' -- --with-mysql-config=/usr/local/Cellar/mariadb-connector-c/2.2.2/bin/mariadb_config --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
Upvotes: 1