Search code examples
pythonazure-sql-databaseosx-yosemitepymssql

Error Installing pymssql on Mac OS X Yosemite


I receive the following error when installing pymssql on OS X Yosemite 10.10.3 - has anyone gotten around the following error? I am using FreeTDS (v0.91.112) version 7.1 and Python 2.7.6 - the tsql utility connects to a SQL Database with no issue.

sudo pip install pymssql

Error:

Command "/usr/bin/python -c "import setuptools, tokenize;
__file__='/private/tmp/pip-build-T5Usla/pymssql/setup.py';
exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n',
'\n'), __file__, 'exec'))" install --record /tmp/pip-uZGqK4-record/install-
record.txt --single-version-externally-managed --compile" failed with error
code 1 in /private/tmp/pip-build-T5Usla/pymssql

Solution

  • You should be able to install pymmsql on your Mac for Azure SQL DB by following these three steps.

    Step 1: Install Homebrew Go to your terminal and run the following command :

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    Step 2 : Install FreeTDS. From the terminal run the following command :

    brew install freetds
    

    This should install freetds on your system

    Step 3 : Install pymmsql. From the terminal run the following command

    sudo -H pip install pymssql
    

    Now you should be able to use pymssql to connect to Azure SQL DB and SQL Server.