.Net Development On MAC

Spread the love

The day has arrived when you can both develop and deploy services for .NET Development on Mac. For that, you’re going to need either a souped-up text editor (such as Sublime Text, Brackets, Atom, Emacs or Vim) together with OmniSharp for IntelliSense, or you’ll want to use Visual Studio Code, the new cross-platform IDE from Microsoft that uses OmniSharp with Roslyn and provides Git integration for version control, plus limited debugging support.

Setting up an environment for .NET development on Mac

In the past when doing .NET development, I’ve typically relied on running a Windows virtual machine inside VMware Fusion. This is still a good option, but nowadays it is possible to develop .NET applications on Mac OS without the use of a virtual machine. In today’s short post we’ll go over the setup required to do so.

What will our development environment consist of?

The typical .NET setup makes use of .NET (duh), SQL Server, and some sort of IDE. Today we’ll be installing the following:

  • SQL Server (inside Docker).
  • The .NET Core SDK.
  • Visual Studio Code.

Other than the SQL Server setup which is a little involved, the above will be a snap… let’s get at it!

  • Installing SQL Server

  • In order to run SQL Server on a Mac, we’ll need to run it from within Docker. So our first step will be to install Docker.

  • Installing Docker

  • The Docker installation is straightforward, just download and install the Mac version of the Docker Desktop. (Note: you’ll need to sign up for a Docker account in order to download the installer.) Once you’ve downloaded and installed Docker Desktop, launch Docker and you’ll see it running in your menu bar. With Docker installed we can now move onto installing SQL Server.

  • Installing SQL Server inside Docker

  • We have a number of terminal commands available now that Docker is installed; one of which is search. We can use this to search for the image we need and can download the image with the pull command.

    The parameters are pretty self-explanatory; the only thing you might want to change is the name or the password value (you need to use a password that meets the SQL Server password policy). Once the above command has run we can verify that SQL Server is running via docker ps -a.

  • Installing .NET Core

  • Installing .NET Core is a snap, just download and run the SDK installer. After doing so, you should be able to run the dotnet command from a terminal window.

  • Installing Visual Studio Code

  • The editor of choice these days is Atom, but Visual Studio Code seems to be very popular and when it comes to developing .NET applications it stands to reason that a Microsoft product is likely to provide the best experience. Installation is straightforward, just download the installer and start.

  • Configuring Visual Studio Code

  • There are a few configuration/setup steps that were helpful when setting up Visual Studio Code. Add the executable to PATH. This allows you to open VSC via the terminal which can be useful for opening a specific directory or the current directory.

    To get this working, open the command palette (View -> Command Palette, or Cmd-Shift-P) and type the shell. You’ll see an option to “Install ‘code’ command in Path”.

    Getting integrated terminal working. VSC has an integrated terminal window but if initially, that doesn’t work and an error message flashes up in the terminal window that would crash, and then you may get the following dialog.

    The terminal process command ‘/bin/bash –I’ failed to launch (exit code: 1)

    For some reason during when the terminal window was opening it was attempting to cd into a directory that did not exist. Then a simple solution:

    Go to user settings (Code -> Preferences -> Settings) and then search for terminal.integrate:cwd.

    One of the first items you’ll see is the start path value, edit it to a directory that actually exists and all will be well. That’s it for setting up a .NET development environment on a Mac, pretty simple!

Tools for .NET Development on Mac

  • Keyboard Remapping

  • One of the most frustrating moments when switching to Mac from Windows could be the keyboard layout. The layout of the Control key, Option key, and Command key is completely different, so remap those keys to continue the Windows development experience by the following app.

    • Karabiner-Elements
    • Karabiner-Elements are a completely free app. It is really excellent for key remapping. After this remapping, both the left command key and the fn key combination get pretty similar to the one in Windows. Therefore, the Command + C and Command + V sequences will become really natural.

  • Better Snap Tool

  • Mac OS provides the screen split view feature, but it’s fairly basic. If you want more, you need to look for a third-party tool. Better Snap Tool is precisely for this purpose. It doesn’t only provide a screen split view from many different perspectives but also provides shortcut features for each split view.

  • .NET Core SDK

  • .NET Core has now been older than three years as a cross-platform and open-source language and framework. The latest version of the .NET Core SDK is 3.1.10. You can download it from the official website.

  • PowerShell Core

  • PowerShell used to be a scripting language, only running on Windows. It’s now open-source and supports cross-platform. Therefore, you can continue the existing PowerShell scripting experience on Mac. Use the Homebrew command to install PowerShell on your Mac.

  • Azure CLI

  • Like Azure PowerShell, Azuer CLI is a cross-platform tool that manages Azure products and services. While developing applications running on Azure, both Azure PowerShell and Azuer CLI are necessary because they complement each other. Therefore installing both would be a good idea.

  • Azurite

  • Azurite is an emulator for Azure Storage, and an npm package that running on multiple platforms. If we develop an Azure Functions app, we mostly need Azure Storage account. On Windows, we can use Azure Storage Emulator for local development, but we can’t use it on the other platform. Therefore, Azurite is really a useful tool running cross-platform. The latest version is 3.3.0-preview, but it’s not stable yet. So, using 2.7.1 would be great instead.

  • Azure Storage Explorer

  • Azure Storage Explorer helps navigate both local and cloud storage services like Azure Storage Account, Cosmos DB, and Azure Data Lake. It’s also running on multiple platforms.

  • Docker for Mac

  • Docker for Mac runs dockerized containers natively on Mac OS. Docker includes Docker Engine, Docker CLI client, Docker Compose, Notary, Kubernetes, and Credential Helper.

  • GitKraken

  • Mac OS contains the git CLI out-of-the-box. But, if you prefer to use GUI, there are many cross-platform tools for it. GitKraken is one of them. It offers both free and paid versions. In most cases, the free version would be sufficient.

  • IDE

  • There are roughly two IDEs on Mac for .NET application development. One is Visual Studio for Mac, and the other is Visual Studio Code.

    • Visual Studio for Mac
    • Visual Studio is a full-featured development platform by Microsoft that allows you to create, modify, and ship code from start to finish. Microsoft suggests multiple payment plans for the IDE to allow individual engineers and enterprises to leverage its rich toolset

    • Visual Studio Code
    • Alternatively, we can use Visual Studio Code. It’s built for cross-platform and has a large extensions pool. Admittedly it can’t fully replace Visual Studio, but with many extensions, it can keep up most things. In fact, VS Code itself is enough for .NET applications. But installing several extensions will give you much relief.

  • Postman

  • Postman is still widely used for API development and testing. There are other useful tools as its alternatives. So, feel free to choose the right one for your purpose.

  • Snag It

  • Snag helps for screenshots. If you think that the default feature on Mac OS is not enough, this will be useful. But make sure that this requires payment. If you are seeking a free version, you better find out alternatives.

  • Camtasia

  • Camtasia helps with screen recording. Mac OS default feature is still OK, but if you need more features, then consider this tool.

  • Grammarly

  • Grammarly is particularly useful for developers who speak English as their second language. It picks up grammatical errors or suggests appropriate words by analyzing sentences and contexts. If you are writing some technical documents, Grammarly really will be your best friend.

    This supports most modern web browsers, including Microsoft Edge, Mozilla Firefox, and Google Chrome, by providing browser extensions. Alternatively, you can download and install the desktop application.

In The End

So far, we’ve discussed the setting upon the environment for .Net development on mac and several tools for running on Mac that may help or improve your experiences. I hope this article will help others in the future. If you have any software development needs on .Net based technologies, just drop an email to info@oditekolutions.com.

What OdiTek offers

Certified Developers

Deep Industry Expertise

IP Rights Agreement -Source Codes to Customers, legal compliance

NDA – Legally binding non-disclosure terms

Compliance to Software Development Quality Standards

Product Development Excellence

Dedicated Project Manager (Not billed)

Proactive Tech Support-Round the Clock

Commitment to Schedule

High performance, Secure software design

Guranteed Cost Savings & Value Addition

Consistent Achiever of Customer Happiness

Refer our Skills page:

ASP.NET Development

As an ASP NET development company, we specialize in providing a solid, flexible, and proven platform to propel your business into the next generation of corporate growth and prosperity. ASP.NET (Active Server Pages .NET), an open-source framework developed by Microsoft, empowers developers in ASP NET...

Read More

Client Testimonials

If you need additional information or have project requirements, kindly drop an email to: info@oditeksolutions.com

Latest Insights

Python for Web Development : Building Modern Web Applications

Among its many applications, Python for web development has emerged as a cornerstone of modern application building, becoming a preferred choice for developers and businesses...

Exploring Python Web Development Framework for Web Solutions

Python has become one of the most popular languages for web development due to its simplicity, readability, and versatility. A Python web development framework offers...

Middleware as a Service (MaaS): The Future of Cloud-Based Integration

In today's fast-paced digital landscape, Middleware as a Service (MaaS) is transforming how businesses approach cloud-based integration. MaaS streamlines the complex web of applications, data,...

Sitefinity Development Best Practices: Creating a Future-Ready CMS

Businesses need to use a Content Management System (CMS) that not only meets their immediate demands but also gives them the flexibility to scale and...

× How can I help you?