7

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.

Paul White
  • 94,921
  • 30
  • 437
  • 687
Glorfindel
  • 2,205
  • 5
  • 19
  • 26

2 Answers2

3

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.

Randolph West
  • 3,733
  • 13
  • 27
Francesco Mantovani
  • 1,695
  • 14
  • 28
3

Yes, there is an easier path to this now, as of Ventura (I tested on 13.3) and Docker 4.16.

  1. Make sure you are on macOS Ventura - I only know that it works on 13.3 because I can’t test anything earlier now

  2. Make sure Docker is the "Apple Chip" version, 4.16 or later:

    Get the right chip

  3. Enable "Use Virtualization Framework" in Settings > General:

    Enable "Use Virtualization Framework"

  4. Enable "Use Rosetta for x86/amd64 Emulation…" under Settings > Features in Development:

    Enable "Use Rosetta for x86/amd64 Emulation…"

  5. Hit Apply & Restart

  6. 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
    
  7. Proof that COMPRESS() works:

    Glorfindel pudding

Aaron Bertrand
  • 181,950
  • 28
  • 405
  • 624