简体   繁体   中英

How to install gem MySQL on Mac OS 10.6.6

Ruby already installed on 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:

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? If yes, from what resource, what version, how to instal? Please help me, im newbie on 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).

I find the best way to get MySQL on my Mac whenever I format it (which, admittedly, is rarely) is to use 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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