要安装MySQL宝石:

  $ export ARCHFLAGS="-arch i386 -arch x86_64"
  $ gem install mysql -- --with-mysql-config=/usr/local/bin/mysql_config

返回一个错误:

  ERROR:  While executing gem ... (NoMethodError)
  undefined method `spec' for nil:NilClass

我怎样才能解决这个问题?

的信息:

  $ brew list
  git       
  mysql     
  readline

  $ gem env
  RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-10
  - GEM PATHS:
     - /Library/Ruby/Gems/1.8
     - /Users/horace/.gem/ruby/1.8
     - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - http://rubygems.org/

  $ which mysql
  /usr/local/bin/mysql

  $ gem list
  *** LOCAL GEMS ***
  brewbygems (0.3.1)
  sqlite3-ruby (1.3.2)

谢谢!

编辑:

这dtruss输出: http://clomputing.com/temp/dtruss-宝石安装-mysql.txt

有帮助吗?

解决方案

也许尝试使用strace运行一下,看看是什么问题?

strace gem install mysql --with-mysql-config=/usr/local/bin/mysql_config

或者,如果你在Mac OS X     dtruss宝石安装mysql --with MySQL的-配置=的/ usr / local / bin中/ mysql_config

其他提示

有关的Ubuntu(小牛)它是安装

需要
sudo apt-get install libmysqlclient-dev

和该运行后

sudo gem install mysql

有其他diestribution,第一

sudo apt-get install libmysqlclient-dev

和检查其中mysql_config是 http://packages.ubuntu.com/

和运行

sudo gem install mysql --with-mysql-config=path/to/mysql_config
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top