qazxsw1 发表于 2016-1-1 10:14:54

无法在Mac Os下通过Gem安装Mysql

  在Mac Os下通过Gem安装Mysql时,老是报错:
  
  


[*]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

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,于是执行:
  


[*]export PATH=$PATH:/usr/local/mysql/bin   
[*]sudo gem install mysql -v '2.8.1'

export PATH=$PATH:/usr/local/mysql/bin
sudo gem install mysql -v '2.8.1'
  
  问题解决:
  


[*]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...
页: [1]
查看完整版本: 无法在Mac Os下通过Gem安装Mysql