ODBC Driver Installation
Note: The Rust CLI uses Tiberius, which connects to SQL Server directly via the TDS protocol — no ODBC driver is required to run the CLI. This guide is only needed if you want diagnostic tools like
sqlcmdandbcp.
Important: Use ODBC Driver 17 (not 18). Driver 18 dropped support for SQL Server 2008 R2.
macOS (Homebrew)
brew install unixodbc
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql17
# (Optional) Install command-line tools
HOMEBREW_ACCEPT_EULA=Y brew install mssql-tools
Windows
Download and install from https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server
Or use winget:
winget install --id=Microsoft.msodbcsql.17 -e
# (Optional) Install command-line tools
winget install --id=Microsoft.Sqlcmd -e
Ubuntu/Debian
Option 1: Automated Install
sudo ./scripts/install-odbc-ubuntu.sh
Option 2: Manual Install
# 1. Install unixODBC
sudo apt-get update
sudo apt-get install -y unixodbc unixodbc-dev curl gnupg
# 2. Add Microsoft repository
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
echo "deb [signed-by=/usr/share/keyrings/microsoft-prod.gpg] https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list main" | sudo tee /etc/apt/sources.list.d/mssql-release.list
# 3. Install ODBC Driver 17
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
# 4. (Optional) Install command-line tools
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
Other Linux Distributions
See official Microsoft documentation: https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
Verify Installation
# Check ODBC configuration
odbcinst -j
# List installed ODBC drivers
odbcinst -q -d
You should see:
[ODBC Driver 17 for SQL Server]
Troubleshooting
Issue: Repository not found (Ubuntu)
Solution: Adjust the Ubuntu version in the repository URL (e.g., 20.04, 22.04, 24.04)
Issue: GPG key error (Ubuntu)
Solution: Re-import the Microsoft GPG key:
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
Issue: Connection timeout
Solution: Check firewall settings and network connectivity:
# Test SQL Server port
nc -zv your-server.database.windows.net 1433