I'm on OS X Yosemite 10.10.2. I dont know what I did for this to happen and I'm struggling to figure what the issue is.
Basically all most of my rails commands are failing. I'm using zsh.
When I try to run bundle install
, I get
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/name/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150903-44386-11qoex1.rb extconf.rb --with-mysql-config=usr/local/bin/mysql_config/
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
-----
Cannot find mysql_config at usr/local/bin/mysql_config/
-----
*** 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/name/.rvm/rubies/ruby-2.2.1/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
extconf failed, exit code 1
Gem files will remain installed in /Users/name/workspace/application/vendor/bundle/ruby/2.2.0/gems/mysql2-0.3.20 for inspection.
Results logged to /Users/name/workspace/application/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.20/gem_make.out
An error occurred while installing mysql2 (0.3.20), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.20'` succeeds before bundling.
I did,
gem install mysql2 -v '0.3.20'
It suceeded.
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.20
Parsing documentation for mysql2-0.3.20
Done installing documentation for mysql2 after 0 seconds
1 gem installed
Now when I do a bundle install
, it gives me the same error again.
So I tried which mysql2
, it says mysql2 not found
Per this comment https://stackoverflow.com/a/16132663/5245746, I checked my cflags, it looks good to me. Here is mine,
cflags="-I$pkgincludedir -O3 -g -fno-omit-frame-pointer -fno-strict-aliasing -DDBUG_OFF " #note: end space!
I checked the mkmf.log file. Here's the log http://pastebin.com/aZ8ySXd8
I have spent half a day on this and its really frustrating.I fell this is not an issue with mysql2, there is a bigger issue behind this. Can anyone show me some direction ? Do you guys know why this is happening.?
Thanks in advance