Install SQL Server directly to your Mac — no virtual machine required!
- Sql Server Management Studio 2014 Free Download For Mac
- Sql Server Management Studio Tutorial
- Microsoft Sql Management Studio
SQLPro Studio - A macOS, Windows. SQLPro is a 100% native Mac app. This means it can and will outperform any of the other Java based database management interfaces. SQL Server Management Studio is not available for Mac but there are plenty of alternatives that runs on macOS with similar functionality. The best Mac alternative is DBeaver, which is both free and Open Source. If that doesn't suit you, our users have ranked more than 25 alternatives to SQL Server Management Studio and 18 are available for Mac.
Microsoft has made SQL Server available for macOS and Linux systems. This is made possible by running SQL Server from a Docker container. Therefore, there's no need to install a virtual machine with Windows (which was the only way to run SQL Server on a Mac prior to SQL Server 2017).
Install and Configure Docker
This is a prerequisite for installing SQL Server on your Mac. Because the Mac runs SQL Server inside a Docker container, the first thing we need to do is download and install Docker (unless it's already installed). Once installed, we'll increase its memory allocation to a more suitable level for running SQL Server.
- Download Docker from the download page, extract it, and drag it into your Application folder.
- Launch Docker, and go to
Preferences > Advanced
and increase its memory allocation to 4GB
If I've confused you, don't worry. I've written a tutorial with screenshots: Install Docker on a Mac and Configure for SQL Server.
OK, we're now ready to install SQL Server on your Mac.
Now the Actual SQL Server Installation
Now that we've installed Docker and increased its memory allocation, we can go ahead and install SQL Server. The Mac uses the Linux image (the SQL Server for Linux Docker image).
Sql Server Management Studio 2014 Free Download For Mac
Pull the SQL Server Image
Open a Terminal window and run the following command:*
This pulls the latest SQL Server for Linux Docker image to your computer.
* The exact command will depend on which release you download. Also, since I wrote this article, Docker has moved the repository for SQL Server. You might need to use
docker pull mcr.microsoft.com/mssql/server:2017-latest-ubuntu
to download SQL Server 2017.Also, SQL Server 2019 Preview has been available since late 2018. As of late 2019 you can download it at
docker pull mcr.microsoft.com/mssql/server:2019-CTP3.2-ubuntu
.For the latest image, see the official Microsoft repository on the Docker website.
Launch the SQL Server Image
Run the following command to launch an instance of the Docker image you just downloaded:
Replace the container name and password with your own. Also be sure to make a strong password, or you may get an error (see below).
Also, if you downloaded a different container image, replace
microsoft/mssql-server-linux
with your container image.Here's an explanation of the above parameters:
-d
- This is an optional parameter that launches the Docker container in daemon mode. This means that it runs in the background and doesn't need its own Terminal window open. You can omit this parameter to have the container run in its own Terminal window.
--name Homer
- This optional parameter provides a name for the container. This can be handy when stopping and starting the container from the Terminal.
-e 'ACCEPT_EULA=Y'
- The
Y
shows that you agree with the EULA (End User Licence Agreement). This is required in order to install SQL Server. -e 'SA_PASSWORD=myPassw0rd'
- Required parameter that sets the
sa
database password. -p 1433:1433
- This maps the local port 1433 to port 1433 on the container. This is the default TCP port that SQL Server uses to listen for connections.
microsoft/mssql-server-linux
- This tells Docker which image to use. If you downloaded a different one, use that instead.
Password Strength
If you get the following error at this step, try again, but with a stronger password.
Check the Docker container (optional)
Type the following command to check that the Docker container is running.
If it's up and running, it should return something like this:
Show All Containers
The above command only shows those containers that are currently running. To show all containers (whether they're running or not), append the
-a
flag to the command (you can also use-all
):
Check your Installation & Manage SQL Server
Now that you've installed SQL Server on your Mac, you'll probably want to check that you can access it and query it, etc. Then you'll probably want to start creating databases and doing other DB-related tasks. You'll need some sort of management tool for this.
Here are three options:
Sql Server Management Studio Tutorial
sql-cli
sql-cli is a cross platform command line tool for SQL Server. This means you can create databases and query them right from your Mac's Terminal window.
Installation is as easy as running a single command (assuming you already have NodeJs installed).
Azure Data Studio
Azure Data Studio (formerly called SQL Operations Studio) is a free GUI tool from Microsoft. It's a bit more user friendly for those who aren't comfortable with the command line interface.
Installation is as easy as downloading it and dragging it to your Applications folder.
DBeaver
Another GUI option is DBeaver. DBeaver is a free open source database tool that works with many different database management systems (MySQL, PostgreSQL, MariaDB, SQLite, Oracle, DB2, SQL Server, Sybase, MS Access, Teradata, Firebird, Derby, etc).
You have a few options for installing DBeaver. The easiest way is to download the 'installer option', and then run the installation wizard.
Are you wondering if you can use Microsoft SQL Server on Mac?
Are you also wondering if you can use SQL Server Management Studio (SSMS)?
In this quick article, I will do a demo of I you can use MS SQL Server for development.
Step 1: Install Docker Client on Mac
You need to use Docker in order to use SQL Server. If you’re new to Docker and containers, this is a good place to know what it is and what it is for. https://www.docker.com/resources/what-container
Here’s the guide on how to install Docker Client on Mac.
Then also install Docker Compose. Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
I prefer a Docker Compose over a Docker file.
Step 2: Create a Docker Compose and run it
Copy and paste this into a docker-compose.yml file (you have to create this file)
Then go to your terminal and run the file. It has to be inside a folder and you need to navigate to that folder using your terminal. Then run this (without the dollar sign).
$ docker-compose upGo to the dashboard of your Docker Client to see check if the container is running.
Step 3: Install Azure Data Studio
There’s no SSMS for Mac but you can use Azure Data Studio to manage SQL Server. Here’s where you can install it.
Azure Data Studio seems like Visual Studio Code. It is lightweight and it is easy to use.
Step 4: Connect Azure Data Studio to SQL Server Container
Now use the Azure Data Studio and login to the database using the credentials in the docker-compose file.
Step 5: Using a backfile
Let’s restore a sample database from Microsoft. The good old AdventureWorks.
Before we proceed to restore, let’s move the AdventureWorks file first to the container’s file system. Run these commands.
$ docker ps
$ docker cp [locationOfBakFile] [containerId:msssqlserverContainerFS]
Run docker ps to see all running containers the get the container ID. You’ll need that in the next command because that locates the directory where you will move the bak file in the container.
Step 5: Restore Data or Create Database
Now we can restore the AdventureWorks. Click the Restore button.
Click restore from. Pick Backup file. Then choose Database
Click the Files tab. Check the Relocate all files.
Then finally click Restore.
Microsoft Sql Management Studio
Now you have the AdventureWorks in Azure Data Studio plus you can start creating your own database and tables.
Click new query then create new database
That’s it. Now you can use the database you created or the AdventureWorks in your ASP.NET Core.
And if you want to delete a database, here’s the query that you need to run.
Make sure you run the query in the database you want to delete.
Until next time. Peace out!