Installing ruby mysql gem in OSX 10.5 (Leopard)
November 9th, 2007 | 10 comments
It took awhile, but I've finally switched over to OSX - and from what I can tell by googling for "OSX Ruby mysql gem", have gone through what seems to be an initiation.
There are many, many, many posts on how to make it install - and most of them didn't work for me. I did get it to work though and actually quite easily once i figured out what to do, so I figured I'd post yet another blog on the subject detailing how it worked, for me.
1 2 |
sudo su ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql |
This made it install, but requiring 'mysql' caused it to explode.. to fix that:
install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle |
The install_name_tool changes where the mysql.bundle looks for the dylib file - by default it was looking in mysql/lib/mysql instead of mysql/lib. The gem install command that worked I found on wishingline.com and some info on the install_name_tool fix was found in this thread of railsforum.com
Hopefully this will be helpful for somebody else trying to install the ruby mysql gem on leopoard!
update Rein has posted a cleaner solution
Thanks a lot, I also had trouble building the extension with the Archflag and MySQL-Dir it worked! :)
Worked Like a champ! Thanks!
yeah worked for me as well! Great job - Thanks!
Thanks for people out there like you that take the time to post their solutions.
Thanks for the tips, these worked like a charm and fixed a bug we were having using ActiveWarehouse.
Thanks man, really cool post
Thank you loads! Saved my hours of tracing the solution!
u da man . thanks heaps!
Thanks a lot! This finally worked for me!
Thank You! Being an OSX/ruby newb, I spent a few days on this and would've spent more if it wasn't for your solution!