How to run SQL Server 2019 on MacBook Pro M1

Kit Loong
3 min readFeb 17, 2022

So, with all the excitement I set up the new development environment on my brand new Macbook Pro M1, happily clone my package https://github.com/kitloong/laravel-migrations-generator, develop and run test, then I found myself in a trouble:

The SQL dockers stopped working!

With the help of Google, I was able to fix the MySQL and PgSQL dockers by adding:

platform: "linux/amd64"

However, this does not fix SQL Server 2019.

Further investigation lead me to this issue https://github.com/microsoft/mssql-docker/issues/668

Long story short, SQL Server 2019 does not support ARM. To run SQL Server on M1 we need to use Azure SQL Edge, but Azure SQL Edge has a few missing features:

Luckily, as suggested and inspired @Meligy, I install Debian 11 AMD64 in UTM, install Docker and SQL Server 2019 on Debian, then port forward 1433 so that local application on Mac M1 could connect successfully.

Prerequisite

First of all, you need to download UTM and Debian 11 respectively,

then, launch UTM to begin the setup.

Setup VM

  1. On the UTM interface, click add VM to open dialog, select “Emulate” > “Linux” > Browse and select the downloaded Debian iso.
  2. Leave everything to default and save.
  3. Before you run the VM, let’s confirm the configuration. You should have:

4. Port forward 22 is for ease of ssh and 1433 is reserved for SQL Server.

5. With the above configured, run the VM and complete the setup. You could follow this article to complete the installation.

Make sure you install ssh server to allow ssh access from local. Also, you could skip GUI, the GUI itself consumed about 3GB.

Install Docker

  1. After Debian was installed and booted successfully, we can ssh and run commands from the local terminal.
ssh debian@localhost -p 22022

2. You could follow the Docker installation from here, here’s my executed commands for installation.

# Remove previous Docker
sudo apt-get remove docker docker-engine docker.io containerd runc
# Install packages
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
# Set up the repository
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update# Install Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
# Test Docker
docker run hello-world

Additional: Sudoer

If you found yourself having trouble running sudo command, kindly follow this article to fix the issue.

Install SQL Server

  1. Docker pull SQL Server
sudo docker pull mcr.microsoft.com/mssql/server:2019-latest

2. Run SQL Server

sudo docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<STRONG_PASSWORD>" \
-p 1433:1433 --name mssql \
-d mcr.microsoft.com/mssql/server:2019-latest

--

--