I have a MacBook with an M1 chip, so (about) the only option for me to run SQL Server is to run it as a Docker container. This works fine for standard SQL, but our application uses some CLR features like COMPRESS
; when I try to use that, it tells me
Msg 50000, Level 16, State 1, Line 45 Common Language Runtime(CLR) is not enabled on this instance.
Enabling it does not work:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
GO
gives
Msg 15392, Level 16, State 1, Procedure sp_configure, Line 166
The specified option 'clr enabled' is not supported by this edition of SQL Server and cannot be changed using sp_configure.
I found this Stack Overflow post but that is about someone using a custom .NET library; I'm looking for the 'standard' functionality available in SQL Server for Windows.
2 Answers 2
Yes, there is an easier path to this now, as of Ventura (I tested on 13.3) and Docker 4.16.
Make sure you are on macOS Ventura - I only know that it works on 13.3 because I can’t test anything earlier now
Make sure Docker is the "Apple Chip" version, 4.16 or later:
Enable "Use Virtualization Framework" in
Settings
>General
:Enable "Use Rosetta for x86/amd64 Emulation..." under
Settings
>Features in Development
:Hit Apply & Restart
Create a new container adding the important
--platform=linux/amd64
argument; while it should work for any image in the hub, this command is for SQL Server 2022, and is the only one where I have validated that it works:docker run --platform=linux/amd64 \ -e ACCEPT_EULA=1 \ -e MSSQL_SA_PASSWORD=sTr0ng3st_p@ssw0rd! \ -p 1433:1433 -d \ mcr.microsoft.com/mssql/server:2022-latest
Proof that
COMPRESS()
works:
-
In Docker Desktop 4.26, the feature seems to have been promoted out of beta; I could skip steps 3 and 4.Glorfindel– Glorfindel2024年01月11日 15:47:00 +00:00Commented Jan 11, 2024 at 15:47
-
@Glorfindel Not at a suitable machine at the moment but are these options located elsewhere (and both enabled by default)?Aaron Bertrand– Aaron Bertrand2024年01月11日 16:34:51 +00:00Commented Jan 11, 2024 at 16:34
-
'Use Virtualization framework' is still under General, activated, but I can't deactivate it. And now that I have a second look, 'Use Rosetta for x86/amd64 emulation on Apple Silicon' is there as well (activated by default). Here's a screenshot you could use: i.sstatic.net/AhBBA.pngGlorfindel– Glorfindel2024年01月11日 16:39:25 +00:00Commented Jan 11, 2024 at 16:39
You are not alone running SQL Server container images on MacBook Pro M1: and in fact CLR is missing from Azure SQL Edge container images.
However a brave person was able to install SQL Server 2019 on Windows Server 2016 on a M1 Max MacBook Pro by using an emulator called UTM, which itself is an abstraction over QEMU.
The recommended x86_64 architecture is this:
Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-6.1) (q35)
Use it as the basis of your virtual machine and configured it with two CPU cores, 8GB RAM, and a 127GB virtual hard drive.
Explore related questions
See similar questions with these tags.