Set Up a .NET Core C# Development Environment on MacOS
Set Up a .NET Core C# Development Environment on MacOS

In this course, you will learn how to install .Net Core and Visual Studio Code on a Mac and then create a simple application using the two of them.


Hi there, my name is Hallam Webber, and today I want to show you how to install .NET Core and  Visual Studio Code on a Mac. The Cloud Academy C# Programming learning path starts with the Introduction to C# course, where I show you how to set up a development environment on Windows and Ubuntu. Having demonstrated this process on the first and third most popular desktop operating systems, it's only proper to include the second, macOS. .NET Core is a cross-platform development and runtime environment, and C# is a fully-featured object-oriented language. .NET Core and C# have a large user base and extensive libraries, and their functionality is constantly evolving and expanding with the considerable resources of Microsoft behind it.

First off, let's download and install the .NET 5.0 SDK software development kit from I'll grab the macOS x64 SDK installer that includes runtime software libraries for .NET 5 and ASP.NET core. Once that's downloaded, we can install it like any other software package but clicking on it and following the installer wizard. I'll enter my password to authorize the installation. We can verify the installation by opening a terminal window and typing the dotnet –list-sdks command, which returns the version and installation location.

Next, we'll install Visual Studio Code by going to and downloading the universal stable build. Once downloaded, I'll open VS Code and install the C# language support extension. Click on the extension's icon in the left-hand vertical toolbar and search for C# for Visual Studio Code. When you find it click the blue install button. I know dark themes are popular, but I'm not a fan, so I'll set the color theme to Visual Studio 2019 light.

Now that we've set up the .NET Core and VS Code let's create a simple boilerplate console application with the .NET command-line interface. Before making the app, I'll create a directory structure for my C# projects. So that's Projects, CSharp, and hellomars. Within the hellomars directory, I'll run the dotnet new command for a console application with the -o parameter for the app name as I did in both Windows and Ubuntu. When I run an ls command, we can see the hellomars project directory gets created. Now I can open the project in VS Code with the code dot command, except I can't. As the message says, the command code is unknown.

I can make macOS aware of the code command through VS Code. I'll shut down the terminal window and open up VS Code. Show the command palette by pressing the F1 key or shift + command + P and start typing shell in the search box until you see Shell Command: Install 'code' command in PATH, then select it. Enter your password when prompted to install the code command. Now that's done, we can go back to the hellomars project directory in the terminal and type code dot, which opens VS Code with our C# project.  As this is the first time opening a .NET C# project, the supporting language libraries are downloaded and installed. When you open a C# project, VS Code, or rather the C# extension, prompts you to set up all the libraries and assets needed to build and debug the application. I'll click yes to that. In the top left, a new directory gets added called .vscode, which contains some configuration files for the project.

Let's make a few changes to the boilerplate console application by changing Hello world to Hello Mars. The first hello world program was written in 1972, using a language called B, the precursor to C, which in turn is the ancestor of most of today's programming languages. Yes, there's a small typo which I'll fix up shortly. I'll also grab the first argument from the args array and assign it to a string variable called myName. I explain args, arrays, and variables in the first two courses of the C# learing path. But briefly, arrays are collections of data like a list, where each item can be accessed with a numerical index, and the first item has the index 0, not 1.  MyName is appended to the hello mars literal text with a plus operator.

I'll open up launch.json from the .vscode folder. Launch.json tells VSCode what to do when I run a program from within VSCode. As I'm accessing the first value from the args array, I need to make sure there is at least one item in the array, or else the program will throw an error. I think Elon is an appropriate name. With that done, I'll run the program from within VSCode by selecting Run Without Debugging. There we go, Hello mars from Elon, but still with the typo. I'll fix that, save and run again – OK, cool. Let's run the program from within .NET via the command line. We need to dig down into the bin, debug, and net5.0 to run dotnet with the compiled hellomars.dll passing in Elon as an argument. There we go.


If you want to learn C# .NET programming, join me at Cloud Academy for the C# learning path where I take you from zero to hero. The courses cover C# programming in Windows, Linux, and macOS, where I pay special attention to cross-platform features offered by .NET Core and how to integrate and leverage Azure cloud technology. See you there.

About the Author
Learning Paths

Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a  Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard. 

Covered Topics