简体   繁体   English

如何在Mac OS 10.6上安装mysql gem?

[英]How to install mysql gem on Mac os 10.6?

i just installed MAMP on this iMac and the rubygems but when i run: 我刚刚在这个iMac和rubygems上安装了MAMP,但是当我运行时:

sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config sudo gem install mysql - -with-mysql-config = / usr / local / mysql / bin / mysql_config

gives me 给我


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 mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out ERROR: could not find gem — locally or in a repository ERROR: could not find gem –with-mysql-config=/usr/local/mysql/bin/mysql_config locally or in a repository

how can i install this gem ? 我怎么能安装这个宝石?

使用以下它与我合作

brew install mysql

I found this and worked out perfectly: 我找到了这个并完美地完成了:

you can go to http://www.tmtm.org/en/ruby/mysql/ to download the tar file, and run the command below 您可以访问http://www.tmtm.org/en/ruby/mysql/下载tar文件,然后运行以下命令

# ruby ./install.rb

to install the mysql.rb 安装mysql.rb

Do you have the Xcode developer tools installed on Mac OS X? 您是否在Mac OS X上安装了Xcode开发人员工具? If not, I'd start there. 如果没有,我会从那里开始。

You can download them here: http://developer.apple.com/technologies/xcode.html 您可以在此处下载: http//developer.apple.com/technologies/xcode.html

Once you've installed that, try again. 安装完成后,再试一次。

i'm still getting this 我还是得到了这个


$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config 
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 --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config checking for mysql_ssl_set()... no checking for rb_str_set_len()... no checking for rb_thread_start_timer()... no checking for mysql.h... no checking for mysql/mysql.h... 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-mysql-config

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

You need the mysql development libs to compile it. 你需要mysql开发库来编译它。 If you were on linux you could use "yum install mysql-devel". 如果你在linux上,你可以使用“yum install mysql-devel”。 Not sure about how to get them installed on a mac, but try downloading the connector libraries from here: MySql Connector Downloads 不确定如何在Mac上安装它们,但尝试从此处下载连接器库: MySql Connector Downloads

You may have to pass in a --with-mysql-libs option to point to the directory when the C libraries are unpacked to. 您可能必须传入--with-mysql-libs选项以指向解压缩C库时的目录。 Hope this points you in the right direction. 希望这能指出你正确的方向。

Or you can just put the libraries in the default directory: /usr/lib64/mysql 或者您可以将库放在默认目录中:/ usr / lib64 / mysql

从mysql.com下载mysql-dev

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM