Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christo16/952269 to your computer and use it in GitHub Desktop.
Save christo16/952269 to your computer and use it in GitHub Desktop.
Setup OS X 10.6.4 w/ homebrew, rvm, rails, unixodbc, freetds and SQL Server

Setup new mac from scratch

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

ruby -e "$(curl -fsS http://gist.github.com/raw/323731/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
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
touch .bash_profile
touch .bashrc

.bash_profile

source ~/.bashrc

.bashrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Install ruby and gems

rvm install ruby-1.9.2
gem install bundler
gem install rails -v 3.0.0 --no-ri --no-rdoc

Mongrel

git clone git://github.com/radar/mongrel.git mongrel
cd mongrel
gem install mongrel-1.1.6.gem

mysql

brew install mysql

Unixodbc / freetds

brew install unixodbc # 2.3.0

You must edit homebrew's freetds formula to use unixodbc and TDS version 8.0.

brew edit freetds

Modify the first install line to read

system "./configure", "--prefix=#{prefix}", "--with-tdsver=8.0", "--enable-msdblib", "--mandir=#{man}", "--with-unixodbc=/usr/local"

And finally:

brew install freetds # 0.82

ruby-odbc

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

/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment