我收到此错误:
构建原生扩展。这可能需要一段时间......
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.
我已经尝试了所有here,但我仍然遇到错误。出于某种原因,当我运行locate mysql_config
时,这是我得到的结果:
/Applications/MAMP/Library/bin/mysql_config
/Applications/MAMP/Library/share/man/man1/mysql_config.1
我尝试使用每个路径运行sudo gem install mysql2 -- –with-mysql config=/path/you/identified/above/mysql_config
两次,但我仍然从上面得到错误。我下载了一个新版本的MySql,我有Xcode,但我仍然遇到这些错误。我做错了什么?
答案 0 :(得分:2)
MAMP是否安装了你唯一的mysql安装?如果你已经从mysql包安装了它,那么我认为mysql_config将安装在/ usr / local / bin / mysql_config中,所以你可能想尝试:
sudo gem install mysql2 - -with-mysql-config == / usr / local / bin / mysql_config
仅供参考,/Applications/MAMP/Library/share/man/man1/mysql_config.1路径显然是错误的。这指向mysql_config的man文件而不是实际的可执行文件。
可以肯定的是,你确实尝试过这个吗? (完全一样)
sudo gem install mysql2 - -with-mysql-config = / Applications / MAMP / Library / bin / mysql_config
另外,我不确定与MAMP一起打包的mysql是否有你需要的头文件。您可能最好从http://dev.mysql.com/downloads/mysql/安装mysql,然后尝试安装您的gem。在这种情况下,我认为它会起作用。