Update: These instructions are not for Mac OS X Server — it comes with it’s own version of MySQL installed, and thus the procedure below probably won’t work without some modifications (then again, if you’re running Server, you’re probably skilled enough to figure out what to change yourself). Apologies for anyone on Server who has tried to follow these instructions.
OK, after yesterdays mammoth post this one should be a bit quicker. Basically, there are a few issues with the building of native gems under Mac OS X at the moment, and until they’re dealt with up-stream, getting certain rubygems to install is going to be trial and error.
1. Download and install MySQL
I’ll leave you to figure this out — I use the latest 5.x release myself, but version 4.x will work just as well. You can get the disk images from MySQL.com. There is also a launch daemon written by Jacob Stetser, which you can grab from his blog (I would recommend using this over the MySQL.com bundled startup item).
2. Un-install any MySQL rubygems you may already have installed
We need to remove any earlier – possibly failed – attempts at installing the binding:
Powerbook:~ tony$ sudo gem uninstall mysql
If all goes well, you’ll now be ruby-mysql-less.
3. Download and install the latest MySQL bindings
For some reason, people have been seeing dynamic linker issues with the latest released version of the mysql bindings, but Courtenay over at http://habtm.com/ found that using the version 2.7 bindings resolves this issue
So go ahead and download http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.tar.gz, I’ll wait. When you’re done, extract the archive and switch back to the terminal and cd to where you’ve extracted the source. The parts you need to type are in bold below.
Powerbook:~/mysql-ruby-2.7 tony$ sudo gcc_select 4.0
Powerbook:~/mysql-ruby-2.7 tony$ export PATH=/usr/local/mysql/bin:$PATH
Powerbook:~/mysql-ruby-2.7 tony$ ruby extconf.rb --with-mysql-config
checking for mysql_ssl_set()… yes
checking for mysql.h… yes
creating Makefile
Powerbook:~/mysql-ruby-2.7 tony$ make
gcc -fno-common -arch ppc -g -Os -pipe -fno-common -arch ppc -pipe -pipe -fno-common -I. -I/usr/lib/ruby/1.8/powerpc-darwin8.0 -I/usr/lib/ruby/1.8/powerpc-darwin8.0 -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/local/mysql/include -Os -arch ppc -c mysql.c
cc -dynamic -bundle -undefined suppress -flat_namespace -L"/usr/lib" -o mysql.bundle mysql.o -L/usr/local/mysql/lib -lmysqlclient -lz -lm -lpthread -ldl -lobjc
Powerbook:~/mysql-ruby-2.7 tony$ sudo make install
install -c -p -m 0755 mysql.bundle /usr/lib/ruby/site_ruby/1.8/powerpc-darwin8.0
Guess what? If everything proceeded as above, you’re done! Next time, I’ll post some information about actually using the mysql bindings (even given my preference for sqlite). For now, the Ruby on Rails wiki has some great tutorials and starting points, as well as information about contacting other rails developers. Getting in contact with other Rails developers is something I really recommend you do, as the Rails community has some great minds you can learn from, and some friendly people who can help you when you get stuck. Good luck!
Comments
Posted by Noah on
Posted by Stephane on
Posted by Malcolm on
Posted by Tony on
Posted by Dan on
Posted by Erik on
Posted by ramin on
Posted by Tony on
Posted by ramin on
Posted by James on
Posted by utter on
Posted by Ken Anderson on
Posted by Nick on
Posted by Nick on
Posted by Nick on
Posted by Gerry Shaw on
Posted by Laura Herald on
Posted by Doug on
Posted by Mike Moscow on
Posted by norb on
Posted by Iwan on
Posted by Tony on
Posted by Devon on
Posted by Gregg Seibert on
Posted by joshpaul on
Posted by Iwan on
Posted by Brooks on
Posted by Gary Burke on
Posted by Gary Burke on
Posted by Hendrik on
Posted by Grant on
Posted by Brendan Park on
Posted by Matt James on
Posted by Kenneth Love on
Posted by Chris Joakim on
Posted by Eonflare on
Posted by Santhosh on
Sorry, this conversation has finished.
This post is a bit old now, so I've closed the conversation. If you're keen to keep talking about it, please email me directly.