Homebrew dotnet

     

Homebrew dotnet

Install .NET SDK side-by-side on macOS with Homebrew package manager.

How to Use

The first thing you have to do is to Tap.

brew tap junian/homebrew-dotnet

[!NOTE]

If you’re currently using .NET formula from official homebrew-cask, you need to zap it first e.g., brew uninstall --zap dotnet-sdk.

Installation

You can install .NET version as you wish.

brew install dotnet-sdk@<version>

Or

brew install junian/dotnet/dotnet-sdk@<version>

Uninstallation

You can also uninstall .NET version as you wish.

brew uninstall dotnet-sdk@<version>

Or

brew uninstall junian/dotnet/dotnet-sdk@<version>

.NET SDK Versions

Version Formula
⭐️ .NET 10 RC-1 [email protected]
⭐️ .NET 9 [email protected]
⭐️ .NET 8 (LTS) [email protected]
.NET 7 [email protected]
.NET 6.0 (LTS) [email protected]
.NET 5.0 [email protected]

⭐️ Supported versions

Where is .NET 4 / .NET Core 4?

There is no .NET 4 or .NET Core 4. To avoid confusion, version 4.x is strictly for .NET Framework, can only run on Windows. Microsoft transition from .NET Core to just .NET starting from version 5.

The closest thing with .NET Framework 4.X on macOS is Mono MDK.

.NET Core SDK Versions

Version Formula
.NET Core 3.1 (LTS) [email protected]
.NET Core 3.0 [email protected]
.NET Core 2.2 [email protected]
.NET Core 2.1 (LTS) [email protected]
.NET Core 2.0 [email protected]
.NET Core 1.1 [email protected]
.NET Core 1.0 [email protected]

Special Note for .NET Core 3.1 and .NET 5

If you install .NET Core 3.1 or .NET 5 on Apple Sillicon Mac, the dotnet binary is located at /usr/local/share/dotnet/x64/dotnet. You can make an alias such as:

alias dotnet-x64=/usr/local/share/dotnet/x64/dotnet

Then use it in command like like:

% dotnet-x64 --list-sdks
3.1.426 [/usr/local/share/dotnet/x64/sdk]
5.0.408 [/usr/local/share/dotnet/x64/sdk]

Mono MDK Version

Before Microsoft created a cross-platform .NET, there is a community-developed .NET-compatible implementation called Mono.

Version Formula
Mono MDK 6.12 [email protected]

Xamarin Versions

Following packages depend on Mono MDK.

Version Formula
Xamarin Mac [email protected]
Xamarin iOS [email protected]
Xamarin Android [email protected]

Visual Studio for Mac

Following apps requires Mono MDK.

Version Formula
Visual Studio 2022 for Mac visual-studio@2022

Brief History of .NET

If you’re confused with .NET version and naming, here’s a brief history:

  1. 2002: .NET Framework (Windows-only, closed source)
  2. 2004: Mono (Community-driven, cross-platform, open source)
  3. 2011: Xamarin (Mono for Android, MonoTouch for iOS)
  4. 2016: Microsoft acquires Xamarin & releases .NET Core (Modern, cross-platform, open source)
  5. 2020: .NET 5 unifies everything into one platform, simply called .NET (cross-platform, open source)

Cask Updater

I wrote a simple script to update the supported .NET versions Casks automatically. You need to install .NET 10 then run:

./update_casks.cs

If there are any update, it’ll update the cask file. Commit the changes and push.

TODO: Must be nice if it can be done in GitHub workflow.