无法在OSX上安装gem mysql

时间:2021-08-16 20:54:12

I can't install mysql gem on my 10.8 (mac osx) machine. I installed mysql with homebrew by

我无法在我的10.8(mac osx)机器上安装mysql gem。我用自制软件安装了mysql

$brew install mysql

$ brew安装mysql

then I do:

然后我做:

$sudo gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

        /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
checking for mysql_ssl_set()... *** 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
    --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=/Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/bin/ruby
    --with-mysql-config
    --without-mysql-config
/Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/marcinkrzyzanowski/.rvm/rubies/ruby-1.9.3-head/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
    from extconf.rb:50:in `<main>'


Gem files will remain installed in /Users/marcinkrzyzanowski/.rvm/gems/ruby-1.9.3-head/gems/mysql-2.8.1 for inspection.
Results logged to /Users/marcinkrzyzanowski/.rvm/gems/ruby-1.9.3-head/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

any idea what to do?

知道该怎么办?

4 个解决方案

#1


2  

Did you have mysql installed before you upgraded to Mountain Lion? I had the same problem and this fixed it:

在升级到Mountain Lion之前,您是否安装了mysql?我有同样的问题,这解决了它:

brew uninstall mysql
brew install mysql
gem install mysql

#2


1  

You'll need a C compiler to compile some of the native extensions. (This is a Ruby requirement. You'll see this error in many more cases where a gem uses C code)

您需要一个C编译器来编译一些本机扩展。 (这是Ruby的要求。在gem使用C代码的更多情况下,你会看到这个错误)

  • Easiest way is to install Xcode.
  • 最简单的方法是安装Xcode。

  • But Xcode has a lot of extra utilities that you might not need if you wan't only the compilers. There is a project (now supported by Apple) that installs only the command-line tools (various compilers and stuff) called Commandline tools for Xcode. Install this (or Xcode) and then try to install the gem.
  • 但是,如果您不仅仅是编译器,Xcode还有许多额外的实用程序,您可能不需要这些实用程序。有一个项目(现在由Apple支持)只安装命令行工具(各种编译器和东西),称为Xcode的命令行工具。安装此(或Xcode),然后尝试安装gem。

#3


0  

I had a pain in the back trying to install mysql from command line, so I just went to the website and got it. Here is the link: http://dev.mysql.com/downloads

我在后面试图从命令行安装mysql时感到很痛苦,所以我只是去了网站并得到了它。这是链接:http://dev.mysql.com/downloads

Then choose the dmg version and install it.

然后选择dmg版本并安装它。

This is absolutely the answer you did want to receive I bet (same here), but I could not do it otherwise.

这绝对是你想要接受的答案我打赌(同样在这里),但我不能这样做。

I'm on OS X 10.7.4

我在OS X 10.7.4上

#4


0  

I'm having the exact same issue, so let's see if we can work through it together. I've gone through a ton of Stack Overflow posts, and nothing anyone suggests works.

我有完全相同的问题,所以让我们看看我们是否可以一起完成它。我已经浏览了大量Stack Overflow帖子,没有任何人建议工作。

  • XCode 4.6.3 Installed
  • XCode 4.6.3已安装

  • Mysql 5.6.12 x64 installed from DMG
  • 从DMG安装Mysql 5.6.12 x64

  • OSX 10.8.4
  • Ruby 2.0.0-p195

Mysql installed to /usr/local/mysql

Mysql安装到/ usr / local / mysql

Tried to install using the following with no success:

尝试使用以下内容安装但没有成功:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql --   --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib   --with-mysql-include=/usr/local/mysql/include

sudo find / -name mysql.h results in /usr/local/mysql-5.6.12-osx10.7-x86_64/include/mysql.h

sudo find / -name mysql.h结果在/usr/local/mysql-5.6.12-osx10.7-x86_64/include/mysql.h

/usr/local/mysql is a symlink to /usr/local/mysql-5.6.12-osx10.7-x86_64

/ usr / local / mysql是/usr/local/mysql-5.6.12-osx10.7-x86_64的符号链接

I'm going to be working on this until I can get it resolved, so if I come across anything, I'll post it.

我将继续努力,直到我能解决它,所以如果我遇到任何问题,我会发布它。

#1


2  

Did you have mysql installed before you upgraded to Mountain Lion? I had the same problem and this fixed it:

在升级到Mountain Lion之前,您是否安装了mysql?我有同样的问题,这解决了它:

brew uninstall mysql
brew install mysql
gem install mysql

#2


1  

You'll need a C compiler to compile some of the native extensions. (This is a Ruby requirement. You'll see this error in many more cases where a gem uses C code)

您需要一个C编译器来编译一些本机扩展。 (这是Ruby的要求。在gem使用C代码的更多情况下,你会看到这个错误)

  • Easiest way is to install Xcode.
  • 最简单的方法是安装Xcode。

  • But Xcode has a lot of extra utilities that you might not need if you wan't only the compilers. There is a project (now supported by Apple) that installs only the command-line tools (various compilers and stuff) called Commandline tools for Xcode. Install this (or Xcode) and then try to install the gem.
  • 但是,如果您不仅仅是编译器,Xcode还有许多额外的实用程序,您可能不需要这些实用程序。有一个项目(现在由Apple支持)只安装命令行工具(各种编译器和东西),称为Xcode的命令行工具。安装此(或Xcode),然后尝试安装gem。

#3


0  

I had a pain in the back trying to install mysql from command line, so I just went to the website and got it. Here is the link: http://dev.mysql.com/downloads

我在后面试图从命令行安装mysql时感到很痛苦,所以我只是去了网站并得到了它。这是链接:http://dev.mysql.com/downloads

Then choose the dmg version and install it.

然后选择dmg版本并安装它。

This is absolutely the answer you did want to receive I bet (same here), but I could not do it otherwise.

这绝对是你想要接受的答案我打赌(同样在这里),但我不能这样做。

I'm on OS X 10.7.4

我在OS X 10.7.4上

#4


0  

I'm having the exact same issue, so let's see if we can work through it together. I've gone through a ton of Stack Overflow posts, and nothing anyone suggests works.

我有完全相同的问题,所以让我们看看我们是否可以一起完成它。我已经浏览了大量Stack Overflow帖子,没有任何人建议工作。

  • XCode 4.6.3 Installed
  • XCode 4.6.3已安装

  • Mysql 5.6.12 x64 installed from DMG
  • 从DMG安装Mysql 5.6.12 x64

  • OSX 10.8.4
  • Ruby 2.0.0-p195

Mysql installed to /usr/local/mysql

Mysql安装到/ usr / local / mysql

Tried to install using the following with no success:

尝试使用以下内容安装但没有成功:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql --   --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib   --with-mysql-include=/usr/local/mysql/include

sudo find / -name mysql.h results in /usr/local/mysql-5.6.12-osx10.7-x86_64/include/mysql.h

sudo find / -name mysql.h结果在/usr/local/mysql-5.6.12-osx10.7-x86_64/include/mysql.h

/usr/local/mysql is a symlink to /usr/local/mysql-5.6.12-osx10.7-x86_64

/ usr / local / mysql是/usr/local/mysql-5.6.12-osx10.7-x86_64的符号链接

I'm going to be working on this until I can get it resolved, so if I come across anything, I'll post it.

我将继续努力,直到我能解决它,所以如果我遇到任何问题,我会发布它。