Homebrew, FreeTDS and RubyODBC

Published: November 05, 2009

Homebrew is awesome. On my new macbook I elected to use it in place of MacPorts and now I’m in love. I don’t want to give you too much in the way of a sales pitch but all I’ll say is that I feel I’m now that much closer to The Perfect Setup™ (Along with RVM, which is awesome as well).

One thing I used Homebrew for was installing the packages required to get my Rails app talking to SQL Server. There already existed a formula for UnixODBC, but I had to write ones for FreeTDS and RubyODBC which was simple enough (hopefully these will get pulled upstream soon).

After this getting ODBC to work it was a simple matter of:

brew install unixodbc
brew install freetds
brew install ruby-odbc

Configure ~/.freetds.conf and ~/.odbc.ini

Combine this with the awesome activerecord-sqlserver-adapter and it all works a charm. I should also add that this is on Snow Leopard, hence the need for UnixODBC.