How to install MSSQL in Mac

Joydip Nath
2 min readDec 1, 2021

Installation of MSSQL in Mac is a bit tricky as Microsoft doesn’t released any installable pakage of MSSQL server for MacOS. So we need to take advantage of docker to get this done.

We need to install Docker desktop and then we will get MSSQL image. Once MSSQL container is running, we can then use Azure Studio as a editor or any other editor of your choice can be used.

  1. Installation of Docker

To install Docker click here . You will be redirected to docker official page. Download the appropiate Docker Desktop based on your system requirement.

After the installtion of Docker, open the docker app and go to settings ->Resources and make sure that memory is set to 4GB.

docker resource memory allocation

Now docker is running successfully, lets move on to the next step.

2. MSSQL image installation through Docker

Now we need to open terminal and excute the below commands sequentially.

1. Get MSSQL Server image
docker pull microsoft/msssql-server-linux
2. Running the docker container
docker run -d — name MSSQL_Server -e ‘ACCEPT_EULA=Y’ -e ‘SA_PASSWORD=mypassword’ -p 1433:1433 microsoft/mssql- server-linux
**Note**
if <mypassword> doesn't aling with MSSQL password rule then we might get some error while running the container.
3. Install SQL CLI as Admin
sudo npm install -g sql-cli
4. Check the current running status of containers
docker ps -a
5. Connect to mysql instance from CLI
mssql -u sa -p <mypassword>
6. Run any container from CLI using Container ID
docker restart <containerID>

At this point we have successfully installed and running MSSQL server through docker container.

3. Installation of Azure Data Studio

Azure Data Studio provides a GUI for using the MSSQL database, you can download by clicking here.

Once downloaded and Install, all we need to do is make a connection to MSSQL server.

Well, we are now all set to use MSSQL in MacOS….

I will be happy to resolve any issue related to this, let me know in the comment section below.

--

--