1

Is there anyway I could install MySQL gem for rails without Xcode? Many sites have mentioned XCode as optional requirement for installation. But Command line tools is installed.

I have installed rails , ruby, homebrew, MacPorts without XCode.But MySql gem could not be installed

Note: I have installed Command line tools for Xcode. But not full Xcode.

I have followed these references,

http://scotty-t.com/2012/04/02/intstalling-mysql-5-5-on-os-x-mountain-lion/

With setting path in bash_profile

But I keep on getting these errors while trying

sudo gem install mysql

Errors

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
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no

checking for mysql/mysql.h... no * 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-mysql-config --without-mysql-config

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.9.0 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.9.0/ext/mysql_api/gem_make.out

Should I install XCode first? Thanks in advance!

1
  • Just a note: "Check the mkmf.log file for more details" <- did you do this?
    – pzkpfw
    Dec 11, 2012 at 12:56

2 Answers 2

1

While you exec sudo gem install mysql, you're installing a gem which names mysql, not the database. This gem depende on a file named libmysql, which come with the mysql database.

In other words, you have to install mysql db on your machine first, then install the gem. Otherwise, the gem can't build because it can't find the file it need.

Since you have homebrew, you can install mysql db by exec brew install mysql. After that, sudo gem install mysql could work.

0
0

Do you have installed mysql-devel ? If not, try this

$ sudo yum install mysql-devel ;sorry it's for fedora

do it for lion, then

$ gem install mysql

If there still is error, try add a config path when you install the gem.

3
  • Thanks for your reply. I tried 'gem install mysql' for which I got the following errors.
    – Bharath Mg
    Dec 11, 2012 at 13:09
  • OK, but I think error is made because you haven't installed mysql-devel in your OS. I saw it because error which is caused through lack of some header files. So I think installation of mysql-devel can solve your problem.
    – MC2DX
    Dec 11, 2012 at 13:13
  • No, same thing happens again.
    – Bharath Mg
    Dec 11, 2012 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.