0

我关注了这篇文章,http://blog.teamtreehouse.com/installing-ruby-rails-and-mysql-on-os-x-lion

我学习 Ruby 和 Rails 已经一个月了,所以对 Ruby 还是比较熟悉的。由于遵循几个教程获得的理解,我也了解了 Rails 的某些部分。

但是,我不断失败gem install mysqlgem install mysql2之前失败rails new photos -d mysql

我已经成功完成brew install mysql并检查了mysql -u root

seodongju@Seoui-MacBook-Pro ~/Desktop/Projects$ sudo gem install mysql2 
Password: 
Building native extensions. This could take a while... 
ERROR: Error installing mysql2: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql.h... no

checking for mysql/mysql.h... no
mysql.h is missing. please check your installation of 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 --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=/usr/local/rvm/rubies/ruby-2.0.0-p247/bin/ruby --with-mysql-config --without-mysql-config

Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.13 for inspection. Results logged to /usr/local/rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.13/ext/mysql2/gem_make.out
4

1 回答 1

-2

你应该先在你的机器上安装 MySQL

从这里拿走

http://dev.mysql.com/downloads/installer

安装后安装 Gem

于 2013-07-21T18:24:40.243 回答