Today I’m gonna bring you a getting started tutorial about C# just (absolutely) for Mac guys. As you already know, now the .NET framework is open source and it is also known as .NET Core. So even your a Linux guy or Mac guy it doesn’t matter, you can now use your favorite language C# anywhere you want. All you need is to follow these guidelines on how to get started !
So what I’m gonna tell you in this blog post ? Well ,I’m gonna go through few steps that you need to follow in order to work with C# and .NET Core on MacOS.
1 – Installing pre-requisites
First of all you need to have MacOS and a Internet Connection 😉
Then go to https://code.visualstudio.com and download the Visual Studio Code !
Now what ? Now you have to install it and then open it, click and go to extension section in the left side of the Visual Studio Code and you can see C# extension is right at the top of the list and then click Install.
Just after installation is done click Enable and restart the Visual Studio before we move to the next step.
Now head on to the .NET Core site https://www.microsoft.com/net/core and then you have to follow the installation steps given in the .NET Core web page ( Same as I have given here).
First thing you have to do is installing the Homebrew from here http://brew.sh/
What is Homebrew ? Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple’s macOS operating system.
In order to install Open SSL you must have installed Homebrew on your MacOS.
To install Homebrew open the Terminal on your Mac and then copy the code line which is in the Homebrew’s web page and then past it to the Terminal and hit enter !
Following small screenshot is on my Mac Terminal window…
Then let it install the Homebrew… If you already have Homebrew installed into your Mac make sure you’r Homebrew is up to date by running the command :
Now Install the Open SSL using brew by running the following command in Terminal:
brew install openssl
Now, copy other two command which are listed in the .NET Core site and run one after the other in Terminal
First one is ,
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
And the second one is,
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
All right now we just finish installing the pre-requisites lets move to next step.
2 – Install .NET Core SDK
3 – Initializing the Code
So now you have to initilize the code in order to start a project. For that create a new folder in anywhere else in your Mac and then open that folder in VS Code as follows.
Open Visual Studio Code > From the left side click and open the explorer window > Then click the “Open Folder Button”.
Now open up the VS code integrated terminal by: View > Integrated Terminal
To initialize the .NET project type the following command in the terminal.
bash-3.2$ dotnet new
C# .NET developer, mostly interested in Microsoft Technologies, Trainee Software Developer at Microsoft Sri Lanka and Undergraduate Student at Sri Lanka Institute of Information Technology.
Developing Windows Phone & Windows 8 apps, Have a skills of programming in C#, C, C++, Java, Python, and PHP. Good experience in Web designing & Development. Creative and innovative User interfaces and User experience designing Creative and self- motivated.
Interested in Photography, Astronomy,Sky Gazing and learn new technologies.