How to Install SQL Server on a Mac

sql-server-tutorial

In this step by step tutorial, we will show you how to get SQL Server up and running on your Mac in
less than 20 minutes.

And the best thing is, you will have SQL Server on MAC running locally without the need for any virtualization software(like VirtualBox or Parallels Desktop).

Installing SQL Server on a Mac can be done in 9 simple steps – no virtual machine required!
In this video tutorial, we will show you step-by-step how to install SQL Server on MAC.

After installing SQL Server on MAC, you can use our FREE course to learn SQL Server Programming in MAC. Don’t forget to check the course after installing SQL Server on MAC.

Step 1 – Download Docker
Step 2 – Install and Launch Docker
Step 3 – Configure Docker memory settings
Step 4 – Download SQL Server Image
Step 5 – Configure and Run SQL Server on Mac
Step 6 – Download and Install Azure Data Studio
Step 7 – Download AdventureWorks-Sample database
Step 8 – Copy AdventureWorks to Docker filesystem
Step 9 – Restore AdventureWorks to SQL Server

Step 1 – Download Docker

Download the “Docker Desktop for Mac” from the official docker.com website.
Watch this video tutorial on how to download the Docker desktop for Mac:

Step 2 – Install and Launch Docker

After downloading the Docker desktop for Mac, drag and drop it to the ‘Applications’.
Open the ‘Docker’ application, agree and install the docker helper tool.

You will see the docker desktop at the top changing in status from “Docker Desktop is starting”
to “Docker Desktop is running”.

Watch this video tutorial on how to Install and Launch Docker desktop for Mac:

Step 3 – Configure Docker memory settings

You will require the Docker memory settings to be changed from 2GB to 4GB to run
SQL Server on Mac without any issues. This is because SQL Server needs at least 2GB.

Watch this video tutorial on how to change Docker memory settings:

Step 4 – Download SQL Server Image

You got the Docker desktop on Mac installed, launched and the memory settings changed,
next you download and install SQL Server for Linux.

Open a Terminal window and run the following command.

docker pull microsoft/mssql-server-linux

Watch this video tutorial on how to Download SQL Server Image:

Step 5 – Configure and Run SQL Server on Mac

Run the following command to launch an instance of the SQL Server Docker image you just downloaded:

docker run -d --name ms-sql-server -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Valuetech@123' -p 1433:1433 microsoft/mssql-server-linux

Watch this video tutorial on how to Configure and Run SQL Server on Mac:

Step 6 – Download and Install Azure Data Studio

After completing the previous step successfully, SQL Server is up and running on your Mac.

You need to connect to the the SQL server running on your Mac and you would require Azure Data Studio to connect to the SQL Server.

Azure Data Studio (formerly called SQL Operations Studio) is a free GUI tool from Microsoft
and it’s available for macOS, Linux, and Windows.

Watch this video tutorial to learn how to Download and Install Azure Data Studio:

Step 7 – Download AdventureWorks-Sample database

Now you got your SQL Server up and running on your MAC and you have successfully connected to it using the Azure Data Studio.

Next to learn SQL Server Programming in your MAC, you would require some sample database with sample data.

In this step, we will show you how to get one such sample database from Microsoft and how you can take the first step to learn SQL Server Programming on MAC.

Watch this video tutorial to Download AdventureWorks-Sample database:

Step 8 – Copy AdventureWorks to Docker filesystem

You got the AdventureWorks Sample database in your ‘Downloads’ directory.
SQL Server cannot recognize this backup file if it is outside the Docker filesystem.

So, you need to create a ‘backup’ folder in the Docker filesystem and copy this
AdventureWorks Sample database to this folder.

Run the following command to create a ‘backup’ folder in the Docker filesystem:

sudo docker exec -it ms-sql-server mkdir var/opt/mssql/backup

Run the following command to copy this AdventureWorks Sample database from your ‘Downloads’ directory to this ‘backup’ folder in the Docker filesystem:

sudo docker cp AdventureWorks2017.bak ms-sql-server:var/opt/mssql/backup

Watch this video tutorial to learn how to Copy AdventureWorks Sample database to Docker filesystem:

Step 9 – Restore AdventureWorks to SQL Server

As a final step, you will be restoring the AdventureWorks Sample database to the SQL Server
running on your Mac.

Watch this video tutorial to learn how to Restore AdventureWorks to SQL Server:

Summary

We hope this tutorial helped you to Install SQL Server on Mac.
Now you have successfully installed SQL Server on Mac following this step-by-step tutorial.

Next, you can learn SQL Server Programming in MAC Step-by-Step using our FREE course.
Click this link for the FREE course on SQL Server Programming in MAC .

Also, don’t forget to check out Valuetech Academy’s – Microsoft SQL Learning Path

FREE MICROSOFT SQL COURSE

Learn Microsoft SQL real-world scenarios in our free 5-day email course