DEV Community

Sabin Maharjan
Sabin Maharjan

Posted on

Install Microsoft SQL Server in M1/M2 Macbook

There is no official release of MSSQL Server for Mac. The only way to run SQL Server on Mac is by running it from a Docker container.

1. Install and Configure Docker

This is a prerequisite for installing SQL Server on your Mac. Because the Mac runs SQL Server inside a Docker container, the first thing we need to do is download and install Docker (unless it's already installed).

  • Download Docker from the download page, extract it, and drag it into your Application folder.
  • Launch Docker, and go to Preferences > Advanced and increase its memory allocation to 4GB(or more).

Docker Preferences

  • Go to Preferences > Features in development and check option Use Rosetta for x86/amd64 emulation on Apple Silicon

Enable Rosetta for x86/amd64 emulation

2. Creating docker compose file

  • Creating a docker compose file and add following code:
version: "3.9"

services:
    mssql:
      image: mcr.microsoft.com/mssql/server:2022-latest
      volumes:
        - mssql_db:/var/opt/mssql
      ports:
        - 1433:1433
      environment:
        - ACCEPT_EULA=1
        - MSSQL_SA_PASSWORD=Passw@rd

volumes:
    mssql_db:

Enter fullscreen mode Exit fullscreen mode

3. Docker build and run

docker compose up --build

Top comments (1)

Collapse
 
mohiyaddeen7 profile image
mohiyaddeen7 • Edited

Neat. Short and concise 👍