简体   繁体   English

如何在 Mac OS 10.6.6 上安装 gem MySQL

[英]How to install gem MySQL on Mac OS 10.6.6

Ruby already installed on Mac. Ruby 已安装在 Mac 上。 So i just installed rails.所以我只是安装了导轨。

ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]

rails 2.3.11

gem 1.3.5

When i trying: gem install mysql i get this error:当我尝试: gem install mysql我得到这个错误:

89-235-235-64:~ vitali$ gem install mysql
WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
      /usr/bin aren't both writable.
WARNING:  You don't have /Users/vitali/.gem/ruby/1.8/bin in your PATH,
      gem executables will not run.
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 /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Users/vitali/.gem/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
89-235-235-64:~ vitali$ 

Dont understand what to do.不明白该怎么做。 gem install mysql installing without MySQl itself or I should download and install MySQL as prorgamm? gem install mysql 安装没有 MySQl 本身,或者我应该下载并安装 MySQL 作为程序? If yes, from what resource, what version, how to instal?如果是,从什么资源,什么版本,如何安装? Please help me, im newbie on mac.请帮助我,我是mac上的新手。 Big thanks!非常感谢!

You're almost certainly going to need MySQL installed to have the MySQL gem installed (even better is the mysql2 gem, which Rails also works with - just use mysql2 instead of mysql in your database.yml file).您几乎肯定需要安装 MySQL 才能安装 MySQL gem(更好的是 mysql2 gem,Rails 也可以使用它 - 只需在您的database.yml文件中使用 mysql2 而不是 mysql)。

I find the best way to get MySQL on my Mac whenever I format it (which, admittedly, is rarely) is to use Homebrew .每当我格式化它时,我发现在我的 Mac 上获取 MySQL 的最佳方法(诚然,很少)是使用Homebrew So, if you don't have Homebrew installed, I'd start with that... and once that's done, it should be a matter of running sudo brew install mysql , and running the instructions it provides after the installation is done.所以,如果你没有安装 Homebrew,我会从那个开始......一旦完成,应该是运行sudo brew install mysql ,并在安装完成后运行它提供的说明。

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

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