无法安装do_mysql gem?

我正在尝试在我的Snow Leopord系统Macbook Pro 13上安装do_mysql,但我不断收到此错误:

n216-160:~ myself$ sudo gem1.9 install do_mysql Password: Building native extensions. This could take a while... ERROR: Error installing do_mysql: ERROR: Failed to build gem native extension. /opt/local/bin/ruby1.9 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 --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=/opt/local/bin/ruby1.9 --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 /opt/local/lib/ruby1.9/gems/1.9.1/gems/do_mysql-0.10.0 for inspection. Results logged to /opt/local/lib/ruby1.9/gems/1.9.1/gems/do_mysql-0.10.0/ext/do_mysql_ext/gem_make.out n216-160:~ myself$ 

我不知道为什么。 我还用MySQL 5.4.3测试版重新安装了我的MySQL版本,64位正如其他人建议但没有骰子。 有谁知道什么是错的?

你缺少libmysqlclient-dev包。 在Deb系统上,你可以使用它来安装它

 sudo apt-get install libmysqlclient-dev 

不确定mac(也许是“sudo port install libmysqlclient-dev”?)

我有同样的问题,上面的解决方案没有工作,直到我修复我的$ PATH:PATH =“/ usr / local / bin:/ usr / local / sbin:$ PATH”#如果还没有出现PATH =“$ PATH :/ usr / local / mysql / bin“export PATH = $ PATH

 sudo env ARCHFLAGS="-arch x86_64" gem install do_mysql -- --with-mysql-dir=/usr/local/mysql/ 

试试这个

sudo env ARCHFLAGS="-arch x86_64"
gem install do_mysql --with-mysql-dir=/usr/local/mysql/ --ruby=/opt/local/bin/ruby1.9

您必须指定mysql安装的位置以及ruby安装的位置,因为您使用的是ruby1.9,我假设您的计算机上可能还有1.8运行。

您需要安装Mysql并将Mysql二进制文件的路径添加到您的配置文件中。

1)下载并安装MySQL二进制文件(确保选择正确的CPU架构)。

2)编辑文件~/.profile并在你的路径中添加:/usr/local/mysql/bin

3)在新的终端窗口中执行sudo gem install do_mysql

希望有所帮助!

干杯,

马库斯