bitscn.com
无法在mac os下通过gem安装mysql的问题
在mac os下通过gem安装mysql时,老是报错:
java代码
building native extensions. this could take a while...
error: error installing mysql:
error: failed to build gem native extension.
/system/library/frameworks/ruby.framework/versions/1.8/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
貌似是缺少了某些文件导致的,于是看了看/system/library/frameworks/ruby.framework/versions/1.8/usr/bin/ruby extconf.rb发现extconf.rb好像需要mysql的path,于是执行:
java代码
export path=$path:/usr/local/mysql/bin
sudo gem install mysql -v '2.8.1'
问题解决:
java代码
building native extensions. this could take a while...
successfully installed mysql-2.8.1
1 gem installed
installing ri documentation for mysql-2.8.1...
installing rdoc documentation for mysql-2.8.1...
bitscn.com