Question

To install MySQL gem:

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

returns an error:

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

How can I fix it?

Info:

  $ 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)

Thanks!

EDIT:

Output from dtruss: http://clomputing.com/temp/dtruss-gem-install-mysql.txt

Was it helpful?

Solution

Maybe try running it with strace and see what the problem is?

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

or if you're on Mac OS X dtruss gem install mysql --with-mysql-config=/usr/local/bin/mysql_config

OTHER TIPS

For Ubuntu (Maverick) it is needed to install

sudo apt-get install libmysqlclient-dev

and after that run

sudo gem install mysql

for other diestribution, first

sudo apt-get install libmysqlclient-dev

and check where mysql_config is http://packages.ubuntu.com/

and run

sudo gem install mysql --with-mysql-config=path/to/mysql_config
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top