Install .Internet on macOS

  • Install on Windows
  • Install on macOS
  • Install on Linux

In this article, you'll learn how to install .Net on macOS. .Cyberspace is fabricated up of the runtime and the SDK. The runtime is used to run a .Net app and may or may not be included with the app. The SDK is used to create .Internet apps and libraries. The .Cyberspace runtime is always installed with the SDK.

The latest version of .NET is six.0.

Supported releases

The following table is a list of currently supported .NET releases and the versions of macOS they're supported on. These versions remain supported until the version of .Internet reaches end-of-support.

  • A ✔️ indicates that the version of .Cyberspace is however supported.
  • A ❌ indicates that the version of .NET isn't supported.
Operating Organization .NET Core three.1 .NET five .NET vi
macOS 12.0 "Monterey" ✔️ iii.one ✔️ 5.0 ✔️ vi.0
macOS 11.0 "Big Sur" ✔️ three.1 ✔️ 5.0 ✔️ 6.0
macOS x.15 "Catalina" ✔️ 3.1 ✔️ v.0 ✔️ 6.0

For more information virtually the life bicycle of .Internet releases, run across .NET and .Internet Core Support Policy.

Unsupported releases

The post-obit versions of .Internet are ❌ no longer supported. The downloads for these withal remain published:

  • .NET Core 3.0
  • .Cyberspace Core 2.2
  • .NET Cadre 2.ane
  • .NET Cadre two.0

Runtime information

The runtime is used to run apps created with .Net. When an app author publishes an app, they can include the runtime with their app. If they don't include the runtime, it's up to the user to install the runtime.

There are two different runtimes you can install on macOS:

  • ASP.Net Cadre runtime
    Runs ASP.NET Core apps. Includes the .NET runtime.

  • .Internet runtime
    This runtime is the simplest runtime and doesn't include any other runtime. Information technology's highly recommended that you lot install ASP.NET Core runtime for the best compatibility with .Internet apps.

SDK information

The SDK is used to build and publish .Net apps and libraries. Installing the SDK includes both runtimes: ASP.NET Core and .NET.

Notarization

Beginning with macOS Catalina (version 10.15), all software built afterwards June 1, 2022 that is distributed with Programmer ID, must be notarized. This requirement applies to the .Internet runtime, .Cyberspace SDK, and software created with .Cyberspace.

The runtime and SDK installers for .NET have been notarized since February 18, 2022. Prior released versions aren't notarized. If you run a non-notarized app, you lot'll meet an error like to the following image:

macOS Catalina notarization alert

For more data about how enforced-notarization affects .Net (and your .NET apps), come across Working with macOS Catalina Notarization.

libgdiplus

.NET applications that utilise the Arrangement.Cartoon.Common assembly require libgdiplus to be installed.

An easy way to obtain libgdiplus is past using the Homebrew ("brew") package manager for macOS. After installing brew, install libgdiplus by executing the following commands at a Terminal (command) prompt:

              brew update brew install mono-libgdiplus                          

Install with an installer

macOS has standalone installers that can be used to install the .Net half dozen SDK:

  • x64 and Arm64 CPUs

Download and manually install

As an alternative to the macOS installers for .Net, you lot can download and manually install the SDK and runtime. Manual installation is usually performed as part of continuous integration testing. For a developer or user, it'southward mostly ameliorate to employ an installer.

Outset, download a binary release for either the SDK or the runtime from one of the following sites. If yous install the .Cyberspace SDK, you will not need to install the corresponding runtime:

  • ✔️ .NET 6 downloads
  • ✔️ .Internet 5 downloads
  • ✔️ .NET Cadre 3.i downloads
  • All .NET downloads

Next, excerpt the downloaded file and apply the export control to fix DOTNET_ROOT to the extracted binder's location and and so ensure .NET is in PATH. This should make the .Net CLI commands available at the last.

Alternatively, afterward downloading the .Internet binary, the post-obit commands may exist run from the directory where the file is saved to extract the runtime. This will also make the .NET CLI commands available at the terminal and set the required environment variables. Remember to change the DOTNET_FILE value to the name of the downloaded binary:

              DOTNET_FILE=dotnet-sdk-half dozen.0.100-osx-x64.tar.gz export DOTNET_ROOT=$(pwd)/dotnet  mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"  export PATH=$PATH:$DOTNET_ROOT                          

Tip

The preceding export commands simply make the .Internet CLI commands available for the last session in which information technology was run.

You can edit your shell profile to permanently add together the commands. In that location are a number of different shells bachelor for Linux and each has a dissimilar profile. For example:

  • Bash Beat: ~/.bash_profile, ~/.bashrc
  • Korn Shell: ~/.kshrc or .profile
  • Z Shell: ~/.zshrc or .zprofile

Edit the appropriate source file for your shell and add :$Dwelling house/dotnet to the stop of the existing PATH statement. If no PATH statement is included, add a new line with consign PATH=$PATH:$Habitation/dotnet.

Also, add export DOTNET_ROOT=$HOME/dotnet to the end of the file.

This approach lets yous install different versions into separate locations and choose explicitly which one to utilize by which application.

Arm-based Macs

The following sections draw things yous should consider when installing .Internet on an Arm-based Mac.

What'due south supported

The post-obit table describes which versions of .Cyberspace are supported on an Arm-based Mac:

.Cyberspace Version Architecture SDK Runtime Path conflict
half-dozen.0 Arm64 Yes Aye No
half dozen.0 x64 Yeah Yes No
5.0 Arm64 No No Northward/A
5.0 x64 No Yes Yes
3.ane Arm64 No No N/A
3.1 x64 No Yes Yes

The x64 and Arm64 versions of the .NET 6 SDK exist independently from each other. If a new version is released, each install needs to be upgraded.

Path differences

On an Arm-based Mac, all Arm64 versions of .Net are installed to the normal /usr/local/share/dotnet/ folder. However, when you install the x64 version of .Cyberspace half-dozen SDK, it's installed to the /usr/local/share/dotnet/x64/dotnet/ folder.

Path conflicts

The x64 .Net 6 SDK installs to its ain directory, every bit described in the previous section. This allows the Arm64 and x64 versions of the .NET 6 SDK to exist on the aforementioned motorcar. Yet, whatever x64 SDK prior to 6.0 isn't supported and installs to the same location as the Arm64 version, the /usr/local/share/dotnet/ binder. If you desire to install an unsupported x64 SDK, you'll demand to first uninstall the Arm64 version. The opposite is also truthful, you'll need to uninstall the unsupported x64 SDK to install the Arm64 version.

Path variables

Environment variables that add together .Internet to system path, such as the PATH variable, may demand to be inverse if you take both the x64 and Arm64 versions of the .Cyberspace 6 SDK installed. Additionally, some tools rely on the DOTNET_ROOT surround variable, which would also need to exist updated to signal to the appropriate .NET 6 SDK installation folder.

Install with Visual Studio for Mac

Visual Studio for Mac installs the .Internet SDK when the .Net workload is selected. To become started with .NET evolution on macOS, see Install Visual Studio 2022 for Mac.

.NET SDK version Visual Studio version
half-dozen.0 Visual Studio 2022 for Mac Preview 3 17.0 or higher.
five.0 Visual Studio 2022 for Mac version eight.8 or college.
three.1 Visual Studio 2022 for Mac version 8.iv or higher.

macOS Visual Studio 2022 for Mac with the .NET workload selected.

Install alongside Visual Studio Code

Visual Studio Code is a powerful and lightweight source code editor that runs on your desktop. Visual Studio Code is bachelor for Windows, macOS, and Linux.

While Visual Studio Lawmaking doesn't come with an automated .Internet installer like Visual Studio does, calculation .NET support is elementary.

  1. Download and install Visual Studio Code.
  2. Download and install the .NET SDK.
  3. Install the C# extension from the Visual Studio Code marketplace.

Install with bash automation

The dotnet-install scripts are used for automation and non-admin installs of the runtime. You tin download the script from the dotnet-install script reference page.

The script defaults to installing the latest long term support (LTS) version, which is .NET half dozen.0. You tin choose a specific release past specifying the current switch. Include the runtime switch to install a runtime. Otherwise, the script installs the SDK.

              ./dotnet-install.sh --channel 6.0 --runtime aspnetcore                          

Note

The previous control installs the ASP.NET Core runtime for maximum compatability. The ASP.NET Core runtime as well includes the standard .NET runtime.

Docker

Containers provide a lightweight mode to isolate your awarding from the residuum of the host system. Containers on the aforementioned machine share only the kernel and utilise resources given to your application.

.Cyberspace tin run in a Docker container. Official .Net Docker images are published to the Microsoft Container Registry (MCR) and are discoverable at the Microsoft .NET Docker Hub repository. Each repository contains images for different combinations of the .NET (SDK or Runtime) and Bone that you can use.

Microsoft provides images that are tailored for specific scenarios. For example, the ASP.Net Core repository provides images that are built for running ASP.Cyberspace Core apps in production.

For more than information about using .NET in a Docker container, see Introduction to .NET and Docker and Samples.

Next steps

  • How to check if .Net is already installed.
  • Working with macOS Catalina notarization.
  • Tutorial: Get started on macOS.
  • Tutorial: Create a new app with Visual Studio Lawmaking.
  • Tutorial: Containerize a .NET app.