do_mysqlのインストールでエラー
macでdm-mysql-adapterをインストールしようとしたらエラーになってしまった。
$ bundle install Fetching source index for http://rubygems.org/ Installing addressable (2.2.2) Installing data_objects (0.10.2) Installing extlib (0.9.15) Installing dm-core (1.0.2) Installing dm-do-adapter (1.0.2) Installing do_mysql (0.10.2) with native extensions /Users/****/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /Users/****/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb checking for mysql_query() in -lmysqlclient... no *** 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 --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/****/.rvm/rubies/ruby-1.8.7-p302/bin/ruby --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 Gem files will remain installed in /Users/****/****/****/vendor/bundle/ruby/1.8/gems/do_mysql-0.10.2 for inspection. Results logged to /Users/****/****/****/vendor/bundle/ruby/1.8/gems/do_mysql-0.10.2/ext/do_mysql/gem_make.out
下記のサイトを参考にエラーになったdo_mysqlをインストール
env GEM_HOME=`pwd`/vendor/bundle gem install do_mysql -- --with-mysql-dir=/usr/local/mysql/
あとは同じようにdm-mysql-adapterをインストール
env GEM_HOME=`pwd`/vendor/bundle gem install dm-mysql-adapter
これで一応インストールできたが、もう一度 bundle install をすると同じエラーになってしまう。
Gemfile.lockに追記すればエラーなくなりそうだけど、それもヤダしな。
MySQLをdmgじゃなくmacportsで正しい場所(どこ?どこなの?)にインストールしないとダメっぽいなぁ。。。
追記
下記のサイトを参考にMySQLをmacportsでインストールしたらエラーがなくなった!
- MySQL / Mac OS X【MySQLを起動して接続できるか確認】までやった。
$ bundle install Fetching source index for http://rubygems.org/ Using addressable (2.2.2) Using data_objects (0.10.2) Using extlib (0.9.15) Using dm-core (1.0.2) Using dm-do-adapter (1.0.2) Installing do_mysql (0.10.2) with native extensions Installing dm-mysql-adapter (1.0.2) Using nokogiri (1.4.4) Using bundler (1.0.3) Your bundle is complete! It was installed into ./vendor/bundle