在Mac上安装Mysql2

时间:2014-01-06 04:43:36

标签: osx-mavericks mysql2

我在Mac OSX maverick上安装mysql2时遇到问题。请查看我得到的回复

Muhammeds-MacBook-Pro:second_app muhammedz786$ gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"'

Building native extensions with: '--with-mysql-dir="C:\mysql-connector\"'
This could take a while...
sh: -c: line 0: unexpected EOF while looking for matching `"'
sh: -c: line 1: syntax error: unexpected end of file
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

    /Users/muhammedz786/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb --with-mysql-dir="C:\mysql-connector\"

extconf failed, exit code 2

Gem files will remain installed in /Users/muhammedz786/.rvm/gems/ruby-2.0.0-p247/gems/mysql2-0.3.14 for inspection.
Results logged to /Users/muhammedz786/.rvm/gems/ruby-2.0.0-p247/extensions/x86_64-darwin-12/2.0.0-static/mysql2-0.3.14/gem_make.out

请帮助!

1 个答案:

答案 0 :(得分:1)

  1. brew install mysql
  2. mysql_install_db
  3. mysql.server start
  4. gem install mysql2
  5. 还要确保安装了XCode命令行工具。