Skip to main content

.Net on modern Macs

I've become a reluctant .Net "developer" in the last year or so because of professional reasons. I've been a Mac user for the last few years, so that adds a few complications because there's not a lot of useful, reproducable help. Microsoft does offically support the Mac, but it is in the typical Windows style (IMHO) of run this installer, reboot, etc. This is not the way I would like to run "my" Macs. But i've found a way to make life much easier.

You might know that MacOS (nee Mac OS X, bastard child of NeXTOS) is a relatively capable UNIX, but it misses a lot of the things that make Linux (and BSD) easy to live with, a large repository of third party tools outside of the Mac OS (development) tools (largely things like Python and git). This is what Homebrew solves, it brings a very large repository of third party (mainly Free/Open source software) to the Mac using a model somewhat similar to APT or RPM on Linux.

One thing that only becomes clear after using Homebrew for a while that there's two ways to install packages using the brew command, the command alone brew install <package> and the cask variant brew install --cask <package> . The first variant is mostly used for installing the usual open source based packages, the cask version is in general used for closed source based "applications". I really like having randomly installed packages (epsecially those necessary for software developemnt) administered using a package repository, which bring us (finally) to .Net.

The first, obvious, package you might want to install is dotnet

brew install dotnet

The problem is that this installs the latest .Net runtime (whatever it is called) on your system but nothing else.

The second option is to install dotnet-sdk

brew install dotnet-sdk

Which installs the latest runtime including the development tools like MSBuild etc.

These are in general usefull unless you develop on larger projects that lock into specific .Net language versions.

Which bring me to the current "solution" that I am using. The github user isen-ng releases regular "casks" for specific .Net language versions in their repository. (note the remarks, they can be important).

Adding the repository to you Homebrew setup is simple:

brew tap isen-ng/dotnet-sdk-versions

Installing a specific version (see link above for details) is therefore relatively painless, just do the following to install the latest net6.0 version:

brew install --cask dotnet-sdk6-0-400

Finding your currently installed .NET versions (if you have any) is not very difficult (showing the results after running the previous command on a new computer):

[host] # dotnet --list-sdks
6.0.405 [/usr/local/share/dotnet/sdk]
[host] #

Starting from .Net 6 (net6.0) the ARM64 architecture is supported, so .Net code will run natively on any device with Apple Silicon chips.