Skip to content

SQL Server 2019 on Apple Silicon redux: it actually works

  • by
Output from SELECT @@VERSION;

Last month I wrote a blog post suggesting that it was not possible to get SQL Server 2019 running on Apple Silicon. I hedged my statement by saying you could get Azure SQL Database Edge running in a Docker container instead, but at the time I could not get SQL Server itself to work at all. I tried Docker, I tried QEMU, I tried DOSBox, I tried Parallels, and nothing seemed to work.

And then last Wednesday evening I got it working: SQL Server 2019 was installed and running on Windows Server 2016, on my M1 Max MacBook Pro. Not only did I get it working, but I was also able to run SELECT @@VERSION; inside sqlcmd from the command line. After playing with the Windows network and firewall settings I even got a remote connection from Azure Data Studio.

The secret, as it turns out, was that I had not used the correct CPU emulator when I previously tried QEMU. As I wrote in the original post, the only way I could envisage it working was through CPU emulation. Since the CPU architecture is so radically different between ARM and Intel, each CPU instruction would have to be translated in real time, which is even slower than it sounds.

So, this brings us to the terrible truth: the only way to get this to work right now is to emulate it. In other words, instead of leveraging the same CPU instructions as the host, your emulation software will have to translate every single CPU instruction into the emulated architecture. This is especially slow if you’re coming from CISC, which has by definition a more complex instruction set than RISC. Additionally, depending on the emulator, your code might have to run in user mode as opposed to kernel mode for security reasons, which makes things even slower.

How did I do it?

The short answer to this is with an emulator called UTM, which itself is an abstraction over QEMU. The trick that I admittedly didn’t try on prior attempts was to use an emulated CPU architecture from 2009, which is the “latest” one that UTM uses.

Ostensibly you would use UTM to run, say, Windows 98 on an iPhone or iPad, because it’s a cool gimmick and it comes with Hearts and Minesweeper. With the release of the M1, it was easy enough for the folks at UTM to release an Apple Silicon version of their emulator for the Mac.

Their recommended x86_64 architecture is this:

  • Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-6.1) (q35)

I used this as the basis of my virtual machine and configured it with two CPU cores, 8GB RAM, and a 127GB virtual hard drive.

For this experiment I first tried Windows 7 just to see if it would work, and when that was successful, I went to Windows Server 2016. Even while it was running on Windows 7, the VM would randomly reboot during particularly heavy operations, like opening Firefox and navigating to a website (I am not exaggerating). To call this sluggish would be kind. To say that the mouse movements were laggy would be high praise.

How reliable is it?

It’s a terrible experience. The virtual CPU seems to be pegged at 100% for almost everything, which makes sense because every single CPU instruction is being emulated in real time. This experience reminds me of when I ran Windows Virtual PC on my G5 iMac, except I think that was marginally quicker than this experience. The boot screen — before Windows even loads — takes about 20 to 30 seconds, and then after I press Ctrl+Alt+Del to log in, another 2 to 3 minutes to display the desktop.

Is it supported?

I would have to say no, and not just because of Microsoft. Apple has not made it easy to get Windows running on their new M1 CPUs to begin with (recall that the Windows 11 Insider for ARM64 that Parallels recommends, is based off their work with Qualcomm), and with no BootCamp to speak of, you’re likely breaking a bunch of licensing rules on both sides.

Summary

Please don’t do this for any other reason than to see it working yourself. Do not run a production workload on UTM. There is no technical support provided by either Apple or Microsoft. Just because it works, doesn’t mean you should do it. Installing Windows alone took over an hour, and it’s just too slow to be practical.

I hope this has been an interesting post all the same. Please share your thoughts in the comments.

3 thoughts on “SQL Server 2019 on Apple Silicon redux: it actually works”

  1. There are a few good reasons to do this. The main one is the learning experience. Often times when doing such exercises, you pick up knowledge of how it works, breaks, and fixes. But, feeding to our inner child, you have not the proud honor of saying “I did what is not supposed to be possible.” Congrats!!!

Comments are closed.