Install MSSQL on MacOS M1 (ARM64)

Prerequisites

To use MSSQL in Mac OS, we will need have a Docker installed in your local machine.

If you don’t already have Docker, download and install it, as follows:

  • Download Docker from the Docker official website, make sure you downloading the Mac Apple Chip installation file.

  • Once downloaded, open the .dmg file and drag the Docker.app icon to your Applications folder as instructed.

  • Launch Docker, you might be prompted for your password.

Installation

From the terminal, run:

docker pull mcr.microsoft.com/azure-sql-edge

This will download the container image to your local machine.

Once the download is completed, run:

# mount to specific host folder in local machine 
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=YourStrongPassword' -p 1434:1433 -v /Users/HappyCoder/workspace/docker-sql-mount-data:/var/opt/mssql/data --name sqledge2 -d mcr.microsoft.com/azure-sql-edge 

# data not persists which is everything reside in the container
sudo docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=YourStrongPassword' -p 1433:1433 --name sqledge -d mcr.microsoft.com/azure-sql-edge

Note: Do update the following parameters:

  • MSSQL_SA_PASSWORD - the sa password of the database to be created

  • --name - the docker container name to be created

Next, check whether the Docker Container is up

You should see the following example if it the container is up

Start the container

Docker CP Command

Reference : https://docs.docker.com/engine/reference/commandline/exec/#options

Copy a local file into container

Copy files from container to local path

Copy a file from container to stdout. Please note cp command produces a tar stream

Connect to SQL Server

There are 2 ways to connect to SQL

MSSQL CLI

  • Connect to SQL server

  • Run a Quick Test to ensure the SQL server is up and running

Azure Data Studio

For installation guide, you may refer to this link

Reference

  • https://database.guide/how-to-install-sql-server-on-an-m1-mac-arm64/

  • https://www.quackit.com/sql_server/mac/install_sql_server_on_a_mac.cfm

Last updated

Was this helpful?