Setup OS X 10.6.4 w/ homebrew, rvm, rails, unixodbc, freetds and SQL Server

  • Download Gist
osx_homebrew_rvm_rails_unixodbc_sqlserver.md
Markdown

Setup new mac from scratch

These commands are good as of 2010-11-18.

Homebrew http://mxcl.github.com/homebrew/

/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

Install xcode (download, or on the OS X install DVD)

http://developer.apple.com/technology/xcode.html

SCM

Git

brew install git

SVN

brew install svn

RVM: http://rvm.beginrescueend.com/rvm/install/

curl -L https://get.rvm.io | bash -s stable

Configure ~/.gemrc

# Add this line to the top
gem --no-ri --no-rdoc

Unixodbc / freetds

brew install unixodbc # 2.3.1
brew install freetds --with-unixodbc # 0.91. Specify --with-unixodbc, otherwise it uses iODBC which has problems with some data types

Install ruby and gems

rvm install ruby-1.9.3
gem install bundler
gem install rails
gem install tiny_tds # >= 0.5.1
gem install activerecord-sqlserver-adapter

Below is only needed if you are NOT using tiny_tds for you database connection (you should be!)

ruby-odbc

gem install ruby-odbc # 0.99992. Note: not needed if you use tiny_tds

/usr/local/etc/freetds.conf, symlinked from homebrew (brew info freetds)

[your_server_name]
host = your.server.com
port = 1433
tds version = 8.0
client charset = UTF-8

/usr/local/etc/odbcinst.ini, symlinked from homebrew (brew info unixodbc)

[FreeTDS]
Description = TD Driver (MSSQL)
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/local/lib/libtdsodbc.so
FileUsage = 1

/usr/local/etc/odbc.ini, symlinked from homebrew (brew info unixodbc)

[yourdsn]
Description = YourDSN
Driver = FreeTDS
Database = some_database
Servername = your_server_name # from freetds.conf
Server = your_server_name # from freetds.conf
Port = 1433
Client charset = UTF-8

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.