Regular SQL Server on Apple Silicon? Yes you can!
Last year, I wrote a tip about using Azure SQL Edge on an M1 MacBook Pro because I couldn't use full-on SQL Server. It's not a big deal to me, since I don't use many of the features that aren't compatible with the Edge flavor (or with Docker containers / Macs in general), at least locally.
But earlier this week, some Stack folks much smarter than me realized we can now do this on Apple silicon, with some prerequisites.
First, the OS
You need to be on macOS Ventura. I only tested on 13.3 so I'm not sure if you need to be on the bleeding edge, but pretty close, and being on the latest can't hurt.
You need a recent version of Docker Desktop to pull this off (4.16+; at the time of writing, 4.17 is current). Make sure you download the "Apple Chip" version, which is not the most prominent download link:
Once that's updated, you need to change two settings. First, you need to enable "Use Virtualization Framework" in
Settings > General:
And then you need to enable the experimental feature "Use Rosetta for x86/amd64 Emulation…" under
Settings > Features in Development:
Apply & restart before moving on.
Ok, now, get the right image
You have a non-Intel Mac, so it's unlikely you already have the SQL Server 2022 container image (or, if you do, it isn't the one with the first cumulative update applied). Grab it like this:
docker pull mcr.microsoft.com/mssql/server:2022-latest
Then fire up a container like this (the important difference is making sure you specify
docker run --platform=linux/amd64 --name RealSQL \ -e ACCEPT_EULA=1 \ -e MSSQL_SA_PASSWORD=Fr00t_L00pth \ -p 2022:1433 -d \ mcr.microsoft.com/mssql/server:2022-latest
That's it! You should have a container up and running, and can connect to it from e.g. Azure Data Studio:
Microsoft's Docker image doesn't have features like full-text search enabled, so right off the bat this isn't a full replacement for SQL Server on Windows (though you can potentially get it working with
mssql-server-fts). But some other features are no longer blocked right out of the box, like the CLR, if you're into that: