Microsoft Developer's who loves to code on Macbook will always dreamt of FullStack .NET development on Mac. Finally , {DotNET, ASP.NET} Core were officially released and SQL Server recently got support for Linux and Microsoft has now published a Docker image for SQL Server for Linux, you can now run SQL Server on Mac via Docker!
First of all, even with all these in place due to the lack of the quality tools which slow down the development phase. So, I'm writing this to provide a step by step process of setting up Development env on Macbook with proper tools which increases the productivity and efficiecy .
-
Install Visual Studio Community Edition for Mac https://www.visualstudio.com/vs/mac/
-
Install Docker Download the (free) Docker Community Edition for Mac (unless you’ve already got it installed on your system). This will enable you to run SQL Server from within a Docker container https://docs.docker.com/docker-for-mac/
-
Configure Docker by increasing the Memory
By default, Docker will have 2GB of memory allocated increase it to 4GB to be at a safer side as SQL Server needs atleast 3.5 GB.
-
Download Sqlserver 2017 Open a Terminal window and run the following command.
docker pull microsoft/mssql-server-linux
-
Launch the Docker Image
sudo docker run -d --name containername -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=reallyStrongPwd123' -e 'MSSQL_PID=Developer' -p 1433:1433 microsoft/mssql-server-linux:2017-latest
You should now have SQL Server running on your Mac, ready for action!
If the STATUS column for your SQL Server container shows Exited . see the troubleshooting guide https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-configure-docker?view=sql-server-linux-2017#troubleshooting
Better Managing the Docker Image's :
Get Kitematic
Kitematic is a nice desktop application for managing Docker containers. The first time you click Open Kitematic, it will prompt you to download and install it. You can then use Kitematic to view the output of your containers, manage their settings, logging, etc.
-
Connect to SQL Server
Get the SQL Operations Studio it is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux. https://docs.microsoft.com/en-us/sql/sql-operations-studio/download?view=sql-server-2017
Now the Development environment is all set up . It's time to test it with the below cheeky code