我无法在我的10.8(mac osx)机器上安装mysql gem。我用自制软件安装了mysql
$ brew install mysql
然后我做了:$sudo gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/bin/ruby
--with-mysql-config
--without-mysql-config
/Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
from extconf.rb:50:in `<main>'
Gem files will remain installed in /Users/marcinkrzyzanowski/.rvm/gems/ruby-1.9.3-head/gems/mysql-2.8.1 for inspection.
Results logged to /Users/marcinkrzyzanowski/.rvm/gems/ruby-1.9.3-head/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
任何想法该做什么?
答案 0 :(得分:2)
在升级到Mountain Lion之前,您是否安装了mysql?我有同样的问题,这解决了它:
brew uninstall mysql
brew install mysql
gem install mysql
答案 1 :(得分:1)
您需要一个C编译器来编译一些本机扩展。 (这是Ruby的要求。在gem使用C代码的更多情况下,你会看到这个错误)
答案 2 :(得分:0)
我在后面试图从命令行安装mysql时感到很痛苦,所以我只是去了网站并得到了它。这是链接:http://dev.mysql.com/downloads
然后选择dmg版本并安装它。
这绝对是你想要接受的答案我打赌(同样在这里),但我不能这样做。
我在OS X 10.7.4
答案 3 :(得分:0)
我有完全相同的问题,所以让我们看看我们是否可以一起完成它。我已经浏览了大量Stack Overflow帖子,没有任何人建议工作。
将Mysql安装到 / usr / local / mysql
尝试使用以下方法安装但没有成功:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include
sudo find / -name mysql.h
导致
/usr/local/mysql-5.6.12-osx10.7-x86_64/include/mysql.h
/ usr / local / mysql 是 /usr/local/mysql-5.6.12-osx10.7-x86_64
的符号链接我将继续努力,直到我能解决它,所以如果我遇到任何问题,我会发布它。