views:

8847

answers:

6

I successfully installed MySql x86_64 in Snow Leopard and Ruby and Ruby Gems seems to be installed properly:

$ which mysql
/usr/local/mysql/bin/mysql
$ which ruby
/usr/bin/ruby
$ which gem
/usr/bin/gem
$ mysql
Your MySQL connection id is 404
Server version: 5.1.37 MySQL Community Server (GPL)
$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
$ gem -v
1.3.5

Unfortunatly I get an error installing mysql gem:

$ sudo gem update --system
...
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
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 --with-mysql-config=/usr/local/mysql/bin/mysql_config
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
+11  A: 

I think you should try to uninstall the old mysql gem first before recompiling

sudo gem uninstall mysql
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Polygraf
Didn't work... :(
Levi Figueira
it works if you have gcc or xcode installed . the above command will work well and has been working well for me till date
lakshmanan
+7  A: 

Installing the Xcode that's bundled with the Snow Leopard fixed the problem.

collimarco
I did, and updated the iPhone SDK to the Snow Leopard version as well.. Still get the same error, so I doubt that's the problem! :(
Levi Figueira
For me as well as a user in another post (http://www.ruby-forum.com/topic/191688) that do the trick.
collimarco
anyone have a suggestion for someone without the snow leopard dvd?
Daniel
A: 

Polygraf's answer worked for me

-1 This is not an answer. Consider instead to comment Polygraf's answer.
collimarco
how? I don't see any interface for adding a comment in his thread. But I did see one for this thread.
You cannot comment on another person's question with less than 50 reputation score.
codescape
A: 

For me, it was adding the UNIX Tools option (if I recalled the name accurately), which include the headers. When I installed XCode originally, I didn't include this component because I didn't think that I would be writing UNIX code. Little did I know...

Craig
A: 

The Polygraf answer worked!

thanks

Thiago Diniz
A: 

If you've installed MySQL 5 using MacPorts, then use the command:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5
rxgx