Installing MSSQL-CLI on macOS

MSSQL-CLI or Microsoft SQL Server CLI is an open source, cross-platform, interactive and syntax highlighting command line query tool for SQL Server. It is an enhanced alternative to SQLCMD. Here we will see how to install MSSQL-CLI on macOS.

Requirements

For installing MSSQL-CLI on macOS, you need:

  • macOS 10.12 (Sierra) or higher.
  • Python 2.7.

Installation

For this demonstration, I’m using macOS High Sierra, MSSQL-CLI 0.15.0.

Installing & Upgrading PIP

MacOS comes with Python pre-installed. Usually the pre-installed Python will be of version 2.7.You can check the installed Python version by launching terminal and executing the command:

python --version

If the version is 2.7, then you need to install and upgrade PIP (Pythons package management system). Follow these steps to do so. If you already have Python 3.6 or higher, ignore this PIP installation and upgrade steps and jump to the MSSQL-CLI installation steps below.

  1. To start with install PIP (Pythons package management system). Open terminal and execute the commend:
    sudo easy_install pip
    

    MSSQL-CLI on macOS Install PIP

  2. If you notice, the easy_install command downloaded and installed pip and its dependencies.
  3. Now, upgrade the pip by executing the command:
    sudo pip install --upgrade pip
    

Installing MSSQL-CLI

After installing and upgrading PIP, you can install MSSQL-CLI using PIP.

  1. In the terminal window, type in the below command and enter.
    sudo pip install mssql-cli --ignore-installed six
    

    MSSQL-CLI on macOS Installation

  2. Now, to see if mssql-cli is working, try launching it with the help argument:
    mssql-cli -h
    

    MSSQL-CLI on macOS

  3. The interactive SQL command line tool is ready for using.

Next Step

 

 

Related Articles & Tools

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.