Did you hear that installing SQL Server on macOS is tricky? That’s not entirely true. While it’s a bit more challenging than on Windows, it should take you no more than 15 minutes anyway. In this post, I’ll explain how to install and set up Microsoft SQL Server on your Mac, step by step, in a way that even a kid could follow.
Working with SQL on a Mac?
Try Base – a lightweight SQLite database manager with a spreadsheet-like interface. Now, you don't need to learn SQL commands. Available with your Setapp subscription.
Try free Security-testedStep 1. Install and config Docker
Microsoft developed SQL Server for Windows, which means to run it on Mac, you’ll need an additional tool. Docker is just the software for the task as it provides an environment for your SQL Server to work in.
Here’s how to install Docker on your Mac.
- Download Docker from the official websiteand install it.
- Open Docker and agree to the terms. During the setup, you’ll need to install a helper tool, so your Mac will ask for your password to confirm the action.
- Sign up for the app. Here's what you'll see:
Step 2. Install SQL Server on Mac
Now you are ready to download, set up, and run SQL Server on Mac.
- Open Terminal.
- Type docker pull mcr.microsoft.com/mssql/server:2022-latest and hit Enter. The command execution will take about 5 minutes to complete.
3. Launch your downloaded SQL Server image in Docker. To do this, use the following command in Terminal, replacing the text in bold with your own data:docker run --name [your desired SQL Server name] -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=[password for your database]' -e 'MSSQL_PID=[your Docker membership type]’ -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
Here is the command I used. The text in bold indicates where you should insert your information.
docker run --nameSQLServer-e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=12345OHdf%e'-e 'MSSQL_PID=Express’-p1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
Note- ACCEPT_EULA=Y in the above command means you are accepting a user license agreement for Docker.
- Your password needs to be at least 8 characters long and include uppercase and lowercase letters, numbers, and symbols.
SQL Server should be running on your machine now. To check, click the Docker icon in your menu bar and go to Dashboard. Here's my container:
Step 3. Install Azure Data Studio
Now, you need to download and install Azure Data Studio. This tool is the Mac equivalent for SQL Server Management Studio (SSMS).
- Download Azure Data Studio from the official Microsoft websiteand open it.
- Click Create a connection and fill in the boxes.
- Server — since SQL Server is running on your own Mac, the server here is just localhost.
- Authentication type — SQL Login (choose it from the drop-down list).
- User name — SA (for system admin).
- Password — the one you’ve entered in the Terminal command to run SQL Server with Docker. That’s 12345OHdf%e in my example.
Here's what you should get:
3. Press Connect.If you receive a connection error notification, press "Enable Trust Server Certificate."
If everything worked fine, your database is now ready for management:
- Top alternatives to Notepad text editor for Mac
- Zsh: Permission denied Terminal error
How to check if SQL Server works properly
If you are able to connect to your running SQL Server in Azure Data Studio, SQL Server should be fully operational.
To test it out, get a sample database from Microsoft and run a few queries. I’ve used theAdventureWorks2022.bak database that corresponds to my SQL Server version. Make sure to select the database version that coincides with your SQL Server version, in my example it’s mcr.microsoft.com/mssql/server:2022-latest, so I used AdventureWorks2022.bak OLTP data file.
- Download the database file and move it to a new system folder for Docker to be able to access (you can also leave it in Downloads).
- Open the Terminal and access the file. If it is in the Downloads folder, move it there with thecd Downloads/ command.
- Create a new directory for your database file with sudo docker exec -it SQLServer mkdir var/opt/mssql/backup command.
- Move your database to the new directory with >sudo docker cp AdventureWorks2022.bak SQLServer:var/opt/mssql/backup command.
- Now, open Azure Data Studio and enable the Restore feature. For this, goto Azure Data Studio > Settings > Settings > Workbench, and choose Enable Preview Features.
6. Return to localhost and click the arrow to expand the menu, and access the Databases folder (see the screenshot above).
7. Right-click on Databases and select Restore Database (Preview).
8. In the window that appears from the "Restore from" drop-down menu, select Backup file.
9. Click on three dots next to "Backup file path" and from there navigate to:var/opt/mssql/backup/AdventureWorks2022.bak
10. Confirm your choice and click Restore.
Now you are ready to test SQL database connection with a few test queries. To do that, just select your newly added sample database and click New Query.
Read also:
- SQL Server Management Studio Alternatives for Mac
- Manage Multiple Databases With Tableplus
- Dbms for Mac
- Use Go With MySQL
Tools for managing databases
Now that you’ve completed your SQL Server setup, it’s time to think about managing your databases.
SQLPro Studio is one of the tools I can recommend. The app excels at all the database management basics that you need — create tables, make custom queries, use autocomplete, and more with this handy tool. SQLPro Studio is a native Mac app and supports multiple database types, including MySQL, PostgreSQL, Microsoft SQL Server, and others.
TablePlus is another app that can help you manage SQL databases. This GUI tool will come in handy for your MySQL, Postgre, SQLite, and other databases. Lightweight and fast, it's super easy to use and makes your databases work lightning fast. Navigate your connected databases, edit data rows or table structure, and more with TablePlus.
Baseis an easy app with a spreadsheet-like interface that simplifies SQLite file management and eliminatesthe need to learn complex SQL commands. Its core features include easy SQLite database creation, instant and consistent data filtering, basic import and detailed export options, smart autocomplete, and more.
Try tools for managing SQLdatabases for free
As you see, installing SQL Server on your Mac is quick and easy, although it requires a virtualization tool, Docker. Since SSMS is not available for macOS, you’ll also need a replacement, which in our article was Azure Data Studio. The tool allows you to connect SQL Server engines to databases, even on macOS.
To manage and edit your databases, you can use specialized tools like SQLPro Studio or TablePlus. Both are available with your Setapp subscription, along with other tools for working with SQL databases, includingSQLPro for SQLiteandBasefor SQLite.
Try these and more tools for daily productivity onSetapp. Start your 7-day free Setapp trialnow!
FAQ
Can you run SSMS on Mac?
No, SQL Server Management Studio only runs on Windows. For macOS, Microsoft recommends using Azure Data Studio.
How do I access an SQL Server database on Mac?
In order to work with SQL databases on Mac, you need to use a virtualization tool like Docker, pull an SQL server image and run it, and then connect it to your Mac with a helper tool. You can do that with Azure Data Studio, or use other tools for the task. Run Azure Data Studio restore tool to add an existing database and check your SQL database connection with a few test queries.
How do I check SQL database status?
To check your SQL database status, you can use DATABASEPROPERTYEX function:
How do I test an SQL database connection?
Get a sample database from Microsoft (e.g., AdventureWorks2022.bak) and run a few queries.
Subscribe to Setapp newsletter Get more handy Mac tips and app insights with the weekly newsletter.The above is the detailed content of How to install SQL Server on Mac. For more information, please follow other related articles on the PHP Chinese website!

macOS WindowServer: Understanding High CPU Usage and Solutions Have you noticed WindowServer consuming significant CPU resources on your Mac? This process is crucial for your Mac's graphical interface, rendering everything you see on screen. High C

Screenshots are everywhere, yet we rarely think about their power to show, explain, and communicate. From reporting software bugs to sharing quick how-tos or funny images, screenshots enrich our daily interactions. While Windows users rely on the S

There are many formats of audio files, which is dazzling. It's cumbersome to manage, and it can be very frustrating when you try to play audio but your favorite player cannot play a specific file due to the file type. This seems hopeless, but don't worry! You can usually convert audio and video files without losing quality. Here we will walk you through how to convert video to MP3, MP4 to MP3, and many other useful audio and video conversions. Easily convert video and audio Save time finding file conversion tools with professional media converter Permute. Free trial safe and reliable! How to convert video to audio For example, converting video to audio (such as MP4 to MP3) is not just a conversion video

OneDrive for Mac: A Comprehensive Uninstall Guide OneDrive, Microsoft's cloud storage service, offers online file storage and synchronization across various platforms, including Mac. However, you might need to remove it for storage optimization, inc

Mac computers are not absolutely safe: A practical guide to protecting against malware You may have heard that Mac computers are not infected with malware and do not need to buy antivirus software. Although it makes sense, this statement is misleading. Compared to Windows, Mac computers are indeed more secure, thanks to their operating system architecture. But that doesn't mean they are indestructible. All kinds of malware, from malicious scripts to viruses and spyware, still have a chance to hack into your Mac. Spyware is particularly worthy of attention because it can cause serious damage to your Mac and your personal information. Let's learn what spyware is and how to remove it from your Mac. What is spyware? Fundamentally, spyware is a malicious intention

GIF Animation Map Guide: Easily convert YouTube videos to GIFs GIF animations are the perfect way to capture moments, express emotions, or add fun to a conversation. But how to convert YouTube videos to GIFs? It used to feel like a brand new challenge, and I didn’t realize how simple it was until I experienced it myself. This guide will show you how to easily make your favorite YouTube videos into amazing GIF animations. Let's get started! Getting done with YouTube videos to GIFs easily in a few steps Gifox software can easily record the screen into GIF animations. Available on the Setapp platform. Free trial Security test My requirements steps to create YouTube videos as GIFs and install them


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft