mysql gem install fails on snow leopard. My computer is 32bit (mac mini core duo)
My end goal is loc开发者_Go百科al development of a Radiant CMS installation. So, need rails and a db to play nice. Previous frustrations with mysql led me to try mamp. I have installed MAMP. It is working. I am open to other avenues though.
Tried to install the mysql gem but got no love.
john-breedloves-mac-mini-2:~ john_breedlove$ sudo gem install mysqlPassword:
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_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... 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:
<Omitted>
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
I have found a lot of advice about installing gems after upgrading to snow leopard but all the good answers seem to point people to getting the 64bit version of mysql installed. I have a 32bit processor.
I have xcode installed.
How do I get this gem installed?
Have you installed mysql on the machine ?
That's the first thing you must do.
Then the problem with Mac OS is that it doesn't install things at the same standard emplacement than on linux. So you must specify the mysql directory.
With macports mysql, I do the following :
sudo gem install mysql --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
Short story is you are going to need to compile mysql by hand to get the libraries you need. By the time you do that, you might not need mamp :P I just kick off mysql manually, and use the dev environment.
http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/
Edit: Just noticed you found Hivelogic. That is the way to go. Once it is compiled, you can't point the mysql gem in the correct direction per the instructions. Also, I believe getting the docs working for the gem is a whole other headache, i would just let it slide.
If you installed mysql through homebrew you might use this:
sudo gem install mysql -- --with-mysql-include=/usr/local/include/mysql --with-mysql-lib=/usr/local/lib/mysql
The '--' is helpful when adding additional configuration parameters.
With bundler you should do something like so:
# bundle config build.mysql --with-mysql-config=/usr/local/bin/mysql_config
# bundle install
精彩评论