MySQL Ruby Gem install issues

Kevin Z picture Kevin Z · Apr 9, 2011 · Viewed 8.2k times · Source

So I know that this question has been asked before, and I have looked through all of the previous answers and still can't find a solution. Hoping you all can help.

The setup: I am running Mac OS X 10.6 Server. I have used the built in MySQL install on web apps and it works great. Now I am trying to run a RoR app that requires MySQL.

So, whenever I enter

gem install mysql

it spits back the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb --with-mysql-config=/var/mysql
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/admin/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
    --with-mysql-config
extconf.rb:35:in ``': Permission denied - /var/mysql --cflags (Errno::EACCES)
    from extconf.rb:35:in `<main>'


Gem files will remain installed in /Users/admin/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql-2.8.1 for inspection.
Results logged to /Users/admin/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql-    2.8.1/ext/mysql_api/gem_make.out

So, through my research, I tried to specifically state the location of the MySQL install.

gem install mysql -- --with-mysql-config=/var/mysql

Unfortunately, with the same results.

Any ideas of where to go from here?

Thanks!

Kevin

Answer

D. Simpson picture D. Simpson · Apr 9, 2011

Kevin,

This article may help you address your problem:

http://rapd.wordpress.com/2007/05/17/battle-against-ror-gem-install-mysql/