Knowledge
  • Read Me
  • Programming
    • ASP.NET
      • .NET Libraries
      • ASP.NET Core
        • Helper
          • Encryption
          • CSV Helper
          • String Helper
        • Logging
          • Simple Serilog
        • Middlewares
          • IP Restrictions
          • Request Throttling
          • Request Logging
        • Console
          • Command Line with arguments
        • JSON
      • ASP.NET Framework
      • Testing
        • Resources
        • xUnit.net
      • Naming Conventions
      • REST API Guidelines
    • Database
      • SQL Style Guide
      • MSSQL
        • Installation
          • Install MSSQL on MacOS M1 (ARM64)
        • Looping
        • Table Valued Functions
        • Session State
        • SQL Cheat Sheet
        • Export Pipe Delimited CSV With cmdshell
      • Redis
        • Redis Installation on Mac OS
        • Redis Installation on Docker
    • Java
      • AWS SDK - SSM
      • mTLS HTTP Connection
      • Read Resource Files
    • Javascript
      • Javascript Libraries
    • Python
    • OpenSSL
      • One Way SSL & Two Way SSL
      • Common OpenSSL Commands
      • Create Self-Signed Certificate
    • Misc
      • Git Commands
      • Windows Commands
      • PowerShell Commands
      • Vulnerabilities Dependency Check
      • Replace Filename Command
      • JSON Web Token (JWT)
      • Rabbit MQ Message-Broker
      • Pandoc Convert Document
  • DevOps
    • What is DevOps
    • CI & CD
    • Azure DevOps
  • Tools
    • Development Tools
Powered by GitBook
On this page
  • Prerequisites
  • Installation
  • Docker CP Command
  • Connect to SQL Server
  • MSSQL CLI
  • Azure Data Studio
  • Reference

Was this helpful?

  1. Programming
  2. Database
  3. MSSQL
  4. Installation

Install MSSQL on MacOS M1 (ARM64)

PreviousInstallationNextLooping

Last updated 2 years ago

Was this helpful?

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 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

docker ps

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

$ docker ps

CONTAINER ID   IMAGE                              COMMAND                  CREATED       STATUS       PORTS                              NAMES
d000f354ee5b   mcr.microsoft.com/azure-sql-edge   "/opt/mssql/bin/perm…"   2 hours ago   Up 2 hours   1401/tcp, 0.0.0.0:1433->1433/tcp   sqledge

Start the container

docker start sqledge

Docker CP Command

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

Copy a local file into container

docker cp ./some_file CONTAINER:/work

Copy files from container to local path

docker cp CONTAINER:/var/logs/ /tmp/app_logs

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

docker cp CONTAINER:/var/logs/app.log - | tar x -O | grep "ERROR"

Connect to SQL Server

There are 2 ways to connect to SQL

MSSQL CLI

  • Connect to SQL server

mssql -u sa -p YourStrongPassword
  • Run a Quick Test to ensure the SQL server is up and running

select @@version

Azure Data Studio

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

For installation guide, you may refer to this

Docker
mssql-cli command-line query tool for SQL Server
SQL Server GUI for your Mac – Azure Data Studio
link