You might think that this will be another post about virtualisation using Parallels Desktop or similar software. Well, it will not. However, unfortunately, it will also not completely deliver what it promises. Unfortunately, there is no version of SQL Server available to install directly on the macOS.

However, we will be installing and using an alternative to SQL Server – the Azure SQL Edge. We will use Docker to install the container for Azure SQL Edge.

Azure SQL Edge is a relational database engine, built on the latest versions of the SQL Server Database Engine. Since Azure SQL Edge is built on the same engine, it provides the same T-SQL programming surface area. SQL Edge is a fully containerised solution which runs on multiple docker engines, including the arm64 Architecture, which is exactly what we need.

So, how does that all help us? Well, we will use docker to run this Azure SQL Edge Engine in a container.

Docker

Docker is a product that enables us to use the software delivered in packages, also in so-called containers, meaning that Microsoft has packaged the Azure SQL Edge database engine in a container which we can then run on our Mac. So, the first step is then, naturally, to install Docker. It’s free.

Docker installation

After the installation, you would naturally launch the Docker. You will be probably prompted to enter your password so that the installation can finish. After that, you will see the docker icon in the Status bar and when you open the Dashboard you will see something like this:

Docker Dashboard on macOS

You can go ahead and minimise this window as we will not yet be needing it.

Install Azure SQL Edge

Now go ahead and open the Terminal. The first thing we will do is pull the Azure SQL Edge image on our local machine:

docker pull mcr.microsoft.com/azure-sql-edge:latest

The image will be pulled to your machine, so wait patiently until it is downloaded:

Docker pull command in Terminal

After that, we need to use the following command to launch an instance of the Docker image previously downloaded – just be sure to replace the yourStrongPassword placeholder with a desired strong password of your choice.

docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=yourStrongPassword' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge

If the command runs with no errors, everything should be fine. You can check the status of the container using the command:

docker ps

You should see something like this:

CONTAINER ID   IMAGE                                     COMMAND                  CREATED         STATUS         PORTS                              NAMES
7d0afd3d51df   mcr.microsoft.com/azure-sql-edge:latest   "/opt/mssql/bin/perm…"   6 seconds ago   Up 5 seconds   1401/tcp, 0.0.0.0:1433->1433/tcp   azuresqledge

However, you might not see anything but a status line, you might want to switch to the Docker Desktop to see what’s going on. For example, if you do not set a strong enough password, the container will be stopped with a message:

ERROR: Unable to set system administrator password: Password validation failed. The password does not meet SQL Server password policy requirements because it is too short. The password must be at least 8 characters...

In this case, it might be the simplest to delete the container using the Docker Desktop GUI and run it again, respecting the Password Requirements this time.

Connect to Azure SQL Edge

Azure Data Studio

We can download and install Azure Data Studio, which is a free tool which allows us to connect to Azure SQL Edge. Here‘s the direct link to the zip File.

After downloading the zip file, simply drag the .app File to your Applications folder and run it. After starting, you can connect to your instance like this:

Connecting to SQL Edge in our container

An alternative to Azure Data Studio: DBeaver

Optionally, you can use DBeaver as well to connect to and work with your Azure SQL Edge installation. The UI might be too Windows-like for you, but I find it to be a bit more powerful tool than Azure Data Studio, as you can perform many operations using the GUI.

When setting up a Connection, simply use “Microsoft SQL Server” as the Server type.

DBeaver connected to our Azure SQL Edge instance

So, there we have it. It is possible to play with a product that is very similar to SQL Server on a Mac with Apple Silicon, which is good news for all DB Admins and Developers who prefer to use Microsoft technologies.