MSSQL in Mac OS?
How to install Microsoft SQL Server (MSSQL) in a Mac OS
Overview
For a long time, Microsoft SQL Server (MSSQL) was primarily a Windows-based database management system. But with the rise of cross-platform development and cloud solutions, Microsoft now provides official support for running MSSQL on macOS — although not natively. Instead, macOS users need to leverage Docker to set up and run SQL Server efficiently.
Whether you’re a developer, database administrator, or just someone looking to experiment with MSSQL on a Mac, this guide will walk you through installing and setting up SQL Server on macOS. By the end, you’ll have a fully functional MSSQL environment running on your Mac, ready for database development, management, or testing.
Let’s dive into the installation process step by step!
Step 1: Install Docker Desktop
Since MSSQL is not natively supported on macOS, the best way to run it is through Docker, which allows you to create a lightweight virtualized environment.
How to Install Docker on Mac
- Download Docker Desktop
- Visit the official DOcker website:
https://www.docker.com/products/docker-desktop - Choose macOS (Apple Silicon) if you have an M1/M2 chip, or macOS (Intel) for Intel-based Macs.
2. Install Docker
- Open the downloaded
.dmg
file and drag Docker into the Applications folder. - Launch Docker Desktop and follow the setup instructions.
3. Verify Docker Installation
- Open Terminal and run:
docker --version
- If you see a version number, Docker is installed correctly.
Step 2: Pull the MSSQL Docker Image
Once Docker is running, you need to download the official Microsoft SQL Server Docker image.
- Open Terminal and run the following command:
docker pull mcr.microsoft.com/azure-sql-edge
This will download the latest version of MSSQL Server.
Step 3: Run MSSQL in a Docker Container
Now that you have the MSSQL image, you can start a container and run the database server.
docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=MyStrongPass123" -e "MSSQL_PID=Developer" -e "MSSQL_USER=SA" -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge
- ACCEPT_EULA=Y → Accepts Microsoft’s End User License Agreement.
- SA_PASSWORD=MyStrongPass123 → Sets a strong password for the SA (System Administrator) account.
- -p 1433:1433 → Exposes port 1433, which MSSQL uses.
- — name mssql → Assigns the name
sql
to the container. - -d → Runs the container in detached mode (in the background).
Step 4: Connect to SQL Server on Mac
Once your MSSQL container is running, you can connect to it using a SQL client.
Using Azure Data Studio
Microsoft provides Azure Data Studio, a cross-platform database management tool.
- Download & Install: https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio
- Open the application and click on New Connection.
- Use the following details:
- Server:localhost
- Username:sa
- Password:YourStrong@Passw0rd
Click Connect, and you should see your SQL Server databases!
Conclusion
Setting up Microsoft SQL Server on macOS is straightforward using Docker. By following this guide, you now have a fully functional MSSQL environment on your Mac, ready for development, testing, or database management.
Quick Recap:
✅ Installed Docker Desktop
✅ Pulled and ran MSSQL in a Docker container
✅ Connected to SQL Server using Azure Data Studio or SQLCMD
✅ Learned how to manage the container and persist data
Now you’re all set! 🚀 If you have any questions or run into issues, feel free to drop a comment. Happy coding!
References
- Microsoft SQL Server on Docker — Official Microsoft documentation on running SQL Server in Docker.
- Docker Desktop for Mac — Official Docker download page for macOS.
- Azure Data Studio — Microsoft’s cross-platform SQL management tool.
- Homebrew Package Manager — The easiest way to install
mssql-tools
and other macOS utilities.