Since the release of .Net Core and the dream of cross-platform development became a reality I’ve been eager to switch my development machine from a Windows laptop to my Macbook Air. I’m happy to say that I’ve been running 99% on a Mac since July of 2022. The move has been easy and fantastic, aside from not being able to develop legacy .Net apps – which are not cross-platform friendly, I’ve been doing all my development on my Mac – I still use my Windows machine for old .Net code. Outside the obvious environment setup and framework installations 90% of the migration was super easy – most of my code is in Github, so a simple clone of each repository was all that was needed to get up and running.
The biggest lift was finding a solution for SQL Server. SQL Server is not available on MacOS, so I had to find way to develop apps with a SQL Server back end. My first solution was to put all SQL Server databases in the cloud on Azure or AWS databases. That is definitely a valid option, but I wanted to run locally so I started looking for alternatives to hosting my development databases in the cloud. That’s where Docker comes to the rescue.
SQL Server Docker Container
Turns out you can run the latest version of SQL Server on a Mac using Docker. All that is needed is to set up a Docker container that is running SQL Server. To get started with SQL Server and Docker follow this tutorial: Quickstart: Run SQL Server Linux container images with Docker. After the tutorial you should be able have a running SQL Server. Out of the box this SQL Server instance won’t have any databases associated to it. So if you need to restore a database from an existing backup, follow this tutorial: Restore a SQL Server database in Docker.
Azure Data Studio
Azure Data Studio is a lot like SQL Server Management Studio but without all of the SSMS features. It works great for development in that you can create databases, query, write stored procedures/views, etc. Essentially the majority of things you would do with Query Analyzer you can do with Azure Data Studio on a Mac.
Once I had the Docker container running with SQL Server I used Azure Data Studio to connect to the server instance on the container. The SQL Server instance is running at localhost:1433 so you can connect just like you would using Management Studio. From there you are able to use the program just like Query Analyzer.
From here you can run .Net Core apps that connect to your SQL Server running in Docker just like you would if you were running on a Windows machine.