Member-only story

5 Best Tips on How to Compile C# on intel-based MacOS (and Linux) Operating Systems.

Steven Rescigno
2 min readJun 4, 2022

--

Let’s get started with installing the required packages. We will use the package management software for macOS (and Linux) named “Homebrew” .

Firstly, we will install the package named Mono from the “mono-project”. For those who are interested in learning more about the project, see the following link.

Mono is an open source project supporting Microsoft’s .NET Framework built for C#. We will need this source code to compile C# in a cross-platform manner.

brew install mono

Let’s take a moment to create a new file with the extension .cs and let’s name the file main . You can name this file however you would like, this will be the starting point of our C# project on MacOS.

Let’s write into the new file and few C# lines of code. We will begin with writing using System; Then include the namespace and class next.

using System;
namespace test {
class test{

}
}

We will next want to include a public method with a set of arguments. We will collect the arguments as an Array of Strings and simply write to our console.

public static void Main(string[] args) {
System.Console.WriteLine("C# compiled for MacOS.");
}

--

--

Steven Rescigno
Steven Rescigno

Written by Steven Rescigno

Designer | Developer | Medium Author

No responses yet