我正在尝试使用以下命令安装 gem dm-mysql-adapter 命令:
gem install dm-mysql-adapter -- --with-mysql-config=/usr/bin/mysql
--with-mysql-lib=/usr/lib/mysql
得到了这个结果:
Building native extensions. This could take a while... ERROR: Error installing dm-mysql-adapter: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb --with-mysql-config=/usr/bin/mysql --with-mysql-lib=/usr/lib/mysql *** 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=/usr/local/bin/ruby --with-mysql-config extconf.rb:43:in `': undefined method `split' for nil:NilClass (NoMethodError) Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/do_mysql-0.10.2 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/do_mysql-0.10.2/ext/do_mysql/gem_make.out
有人遇到过同样的问题吗?我应该怎么做才能解决这个问题? 谢谢!
最佳答案
我遇到了完全相同的问题。我在 OS X 10.6 上安装来自 dev.mysql.com 的最新 MySQL 5.1 包。
无论如何,事实证明修复非常简单,我只需要将 mysql bin 目录添加到我的路径中:
$ export PATH=$PATH:/usr/local/mysql/bin
然后,在相同的命令提示符下(因为路径只针对该 session 发生更改),我使用以下命令安装了 gem:
sudo sudo env ARCHFLAGS="-arch x86_64" gem install dm-mysql-adapter
我知道这个问题已经有 3 个月了,但是这个页面是“无法在 osx 上安装 dm-mysql-adapter”的热门页面,希望这能帮助到一些人。
关于ruby - 安装 gem dm-mysql-adapter 时出现 "undefined method ` split'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4131028/