我一直无法在 OS X Lion 上通过 homebrew 安装 MySQL 来安装 mysql2 gem。我已经尝试了许多安装标志,但我仍然没有运气。这是所有细节。
软件 Mac OS X Lion 10.7 (11A2063)
$ uname -a
Darwin Greenwood.local 11.0.1 Darwin Kernel Version 11.0.1: Wed Jun 29 19:53:22 PDT 2011; root:xnu-1699.23.2~1/RELEASE_X86_64 x86_64
$ which gcc | xargs ls -l
lrwxr-xr-x 1 root wheel 12 Aug 18 14:09 /usr/bin/gcc -> llvm-gcc-4.2
$ brew info mysql
mysql 5.5.14
$ which mysql
/usr/local/bin/mysql
$ which mysql_config
/usr/local/bin/mysql_config
$ ls -l /usr/local/bin/mysql*
$ ls -l /usr/local/lib/libmysql*
请参阅此要点中的输出:https ://gist.github.com/1158628
$ sudo gem install mysql2
请参阅此要点中的输出:https ://gist.github.com/1158612
$ sudo find / -name mysql.h
/usr/local/Cellar/mysql/5.5.14/include/mysql.h
/usr/local/include/mysql.h
$ /usr/local/bin/mysql_config
请参阅此要点中的输出:https ://gist.github.com/1158625
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/bin/mysql_config
请参阅此要点中的输出:https ://gist.github.com/1158618
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-dir=/usr/local
$ sudo gem install mysql2 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/bin/mysql_config
请参阅此要点中的输出:https ://gist.github.com/1158645
我也试过这个答案: OSX 10.7 Lion 上的 MySQL gem
谢谢您的帮助!