Ruby in Leopard
October 25th, 2007
In case you have been sleeping in the same cave as Osama Bin Laden, Apple’s new OS X Leopard includes Ruby as a first-class language.
But Apple’s effort to make the language and all it’s extensions universal binaries can cause you some trouble when installing gems that require compilation.
If you’re installing on an Intel machine and see an error like “ld: symbol(s) not found for architecture ppc”, you probably are installing a gem that requires an external library, for which you only have the i386 version. This is a typical situation when installing mysql (as noted in the troubleshooting page of the MacOSForge wiki for Ruby).
After trying several variations, I came out with this solution:
If your installation command was
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
you need to run it as
sudo bash -c "ARCHFLAGS='-arch i386' gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config"
There you go… that should be all you need to install the mysql gem on Leopard against MySQL’s prepackaged binaries.
UPDATE: The troubleshooting page has been updated to include an alternative: using “sudo s” to start a root shell. I still like my one-liner better :)
July 14th, 2009 04:20 AM It is good to know english, but I'm not programmer :P ..But I am not so ignorant... x) I know some things about some things xP...I've read your web, I like it ;D ... You aren't wrong, some colors would improve this :), Anyhow, "don't judge to a book because of its cover" xP ...Well, from a far land, my regards...from Venezuela x) Qué tengas un buén día PD: I agree, There is no better sensation than to discover you're agree with yourself.