Published: • 3 min read

How to Install SQL Server 2022 on MacOS

Table of Contents

Microsoft is clear that SQL Server doesn’t run natively on macOS. I learned this the hard way in college. I bought a Windows license, set up a VirtualBox VM on my 8GB MacBook Pro, and struggled through installing SQL Server 2016 for a database class. It was a painful experience.

If only 2015 me knew about Docker.

What is Docker?

If you’ve used virtual machines, think of containers as a lighter, more efficient option. Instead of virtualizing hardware and running a full OS for each instance, containers share the host system’s kernel and isolate the app at the process level. For our purposes, it’s SQL Server in a pre-packaged box. Docker runs on Windows, Linux, and macOS.

Installing Docker

Macs come in two types: Intel and Apple Silicon. Docker Desktop supports both, but setup steps are a bit different. Follow the official Docker Desktop install guide and choose the version that matches your architecture.

After installing, open Docker and sign in or create a new account.

Install SQL Server

Deploying SQL Server is surprisingly easy, which is why it’s better than a VM for this use case. Just open Terminal and run these commands:

docker version

If that fails with -bash: docker: command not found, Docker might not be in your system’s PATH. I fixed this with:

sudo ln -s /Applications/Docker.app/Contents/Resources/bin/docker /usr/local/bin/docker

If docker version still doesn’t work, search online for help. Once those issues are fixed, run this command to pull SQL Server 2022:

docker pull mcr.microsoft.com/mssql/server

When that finishes, run this to start SQL Server. Change the password before running:

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<password>" \
   -p 1433:1433 --name sql1 --hostname sql1 \
   -d \
   mcr.microsoft.com/mssql/server:2022-latest

This should complete quickly, and when it’s done, you have SQL Server 2022 running on your local machine on port 1433.

What now?

This setup isn’t for production, but it’s great for local testing, development, and learning. If you want to explore more, check out Docker Hub and the official Microsoft SQL Server on Linux documentation.

That’s it: SQL Server on your Mac, no VM, no problem. If you made it this far, congratulations! You’ve bypassed 2015 me and saved yourself 4GB of RAM and some sanity.