Here I’ll show you how to install SQL Server on a Mac with VirtualBox running Windows (a free trial edition).
The result of this is that you’ll have both Windows and SQL Server running on your Mac. And because you’re using VirtualBox, switching between macOS and Windows is as easy as switching between any other application.
As mentioned, this method involves Windows. If that scares you, then you might be better off installing SQL Server on your Mac via a Docker container. That method doesn’t involve Windows in any shape or form.
But if you don’t mind using Windows (or if you need to), here are the main steps for installing SQL Server for Windows on your Mac using VirtualBox:
SQLPro for MSSQL is a lightweight Microsoft SQL Server database client, allowing quick and simple access to MSSQL Servers, including those hosted via cloud services such as SQL Azure or Amazon RDS. Features include: + Syntax highlighting (including customizable themes). Navicat for SQL Server for Mac OS v.9.1 An ideal solution for administration and development which lets you create, edit databases, run SQL queries and connect to remote SQLServer in an easier way. It features an intuitive GUI and offers powerful visual tools such as Query Editor with. Actual ODBC Driver for SQL Server.
- Download and Install VirtualBox
- Create a New Virtual Machine (VM)
- Download the Windows ISO image
- Install Windows
- Download and Install SQL Server
Below are more detailed instructions for each of these steps.
Download and Install VirtualBox
- The first step is to download VirtualBox from the VirtualBox download page.
- Install VirtualBox just as you’d install any other software. Once the .dmg file has downloaded, open it up and double click on the VirtualBox.pkg icon. This opens the installer. Follow the prompts and close the installer once it’s installed.
VirtualBox is virtualization software by Oracle. It allows you to create virtual machines on your computer. This allows you to install other operating systems onto your Mac (or other computer). The benefit of this is that, once you’ve installed another operating system on your Mac, you can run any software that runs on that operating system.
Create a New Virtual Machine (VM)
This is where you create a new virtual machine that you will install Windows on.
- Open VirtualBox (via the Applications folder)
- Click New
- Follow the prompts to the end. Call the virtual machine Windows or Windows 10 or something descriptive. The default settings on each screen should be fine, although it might pay to bump up the memory to around 4GB (or more if you can afford it) when you get to the Memory Size screen. Just be sure to leave enough memory for your host machine.
Once you’ve finished, your new virtual machine will appear in the VirtualBox side panel.
Download the Windows ISO image
Now that we’ve created a virtual machine, we can go ahead and install Windows on that. But first we need to download it.
If you already have access to a fully licensed edition of Windows by all means use that.
If you intend to keep using Windows (i.e. pay for it), download an ISO file from the Microsoft download page.
Otherwise, you can install a free Windows evaluation trial from the Microsoft Evaluation Center. This allows you to install Windows for free, and trial it for 90 days. If you prefer this option, go to the Evaluation Center and select an edition of Windows to download. Note that the Evaluation Center usually only has the Enterprise Edition and Windows Server.
Once downloaded, move the file to the VirtualBox VMs folder. For example /Users/Bob/VirtualBox VMs/. Or even better, just download the file directly to that folder). This isn’t essential though – if you have another place for the file, go ahead and use that instead.
- Double click on your virtual machine in the VirtualBox side panel (like the one with the arrow pointing to it in the above screenshot).
- Use the interface to browse to the Windows ISO file that you downloaded, and click Start.
- Follow the prompts to install Windows.
Once Windows is installed, the Windows desktop will be displayed.
Download and Install SQL Server
These steps are done using Windows inside the virtual machine you just created (not with your macOS).
- Using the Windows VM that you just installed, open up Edge (Microsoft’s web browser) and download the SQL Server installation file from Microsoft’s SQL Server download page (seeing as you’ll be doing this from within the VM, it’s probably easiest to do a web search for “download sql server” or similar, and choosing the official Microsoft website from the results). The Developer edition is fine, but use whichever edition suits you best.
- Run the installer file and follow the prompts. This downloads and installs SQL Server.
Once SQL Server has been installed, a screen will appear with Installation has completed successfully! Keep this screen open for now – this screen has a button to install SQL Server Management Studio (SSMS). See below for how to install SSMS.
Download and Install SQL Server Management Studio (SSMS)
SQL Server Management Studio is a GUI tool from Microsoft that helps you manage SQL Server. SSMS is one of many tools that you can use with SQL Server, so this step is optional. However, if you’re learning how to use SQL Server, you should definitely learn how to use SSMS.
- While still on the previous screen (i.e. the one that reads Installation has completed successfully!), click Install SSMS to download SQL Server Management Studio. This opens the SSMS download page in a web browser. Find the download link (it will read Download SQL Server Management Studio 17.6 or similar, depending on the version at the time of download) and click it to download SSMS.
- Once downloaded, run the installation file and follow the prompts.
Once SSMS has been installed, you can open it via the Windows Start menu.
When you open SQL Server Management Studio, a connection will need to be established to SQL Server. A connection box will pop up, allowing you to enter your details or confirm the ones that have been pre-populated. Go ahead and click Connect to start using SQL Server.
Optional Extra: Install the VirtualBox Guest Additions
Guest Additions is a free optional extra that can make your life easier when working with your virtual machine. Guest Additions provides closer integration between the virtual machine and the host machine. Guest Additions provides features such as shared folders, time synchronization, mouse pointer integration, and more.
The VirtualBox Guest Additions are installed inside the virtual machine after you’ve installed Windows (or other operating system).
For more information about the Guest Additions, as well as installation instructions, see this Guest Additions help article on the VirtualBox website.
Install SQL Server directly to your Mac — no virtual machine required!
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 > Advancedand 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.
Sql Server Express Installer
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).
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-ubuntuto 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-linuxwith your container image.
Here's an explanation of the above parameters:
- 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.
- This optional parameter provides a name for the container. This can be handy when stopping and starting the container from the Terminal.
Yshows that you agree with the EULA (End User Licence Agreement). This is required in order to install SQL Server.
- Required parameter that sets the
- 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.
- This tells Docker which image to use. If you downloaded a different one, use that instead.
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
-aflag to the command (you can also use
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:
Install Sql Server On Mac
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.
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.