If Homebrew is not installed, get that first.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"brew install unixodbc
brew install freetdsEdit the file /usr/local/etc/freetds.conf
nano /usr/local/etc/freetds.confAdd your connection information to the end.
[<connection_name>]
host = <hostname>
port = <port>
tds version = 7.0Test the new connection with
tsql -S <connection_name> -U <username> -P <password>Run odbcinst -j to find the file directories for odbcinst.ini and odbc.ini
Update odbcinst.ini to include the info below.
odbcinst -j
# get path from results of odbcinst -j
nano /usr/local/etc/odbcinst.ini
[FreeTDS]
Description=FreeTDS Driver for Linux & MSSQL
Driver=/usr/local/lib/libtdsodbc.so
Setup=/usr/local/lib/libtdsodbc.so
UsageCount=1
# control x to saveNext, edit the odbc.ini file.
Add the following info.
odbcinst -j
# get path from results of odbcinst -j
nano /usr/local/etc/odbc.ini
[<connection_name>]
Description = <connection_description>
Driver = FreeTDS
Servername = <connection_name>
# note: FreeTDS must match the name given in odbcinst.iniFinally, pyodbc for python can be installed
pip install pyodbc