Where is .NET Core installed on macOS?

And exactly what versions are installed?

In a recent blog post Iris Classon wrote a PowerShell script that lists installed .NET Core SDK, runtime, and Framework Host versions installed on a Windows machine.

I am mostly using my Mac for .NET Core development so it got me thinking about where .NET Core actually is installed on macOS. The answer is

/usr/local/share/dotnet/

The following script

#!/bin/sh
DOTNET="/usr/local/share/dotnet"

if [ -d $DOTNET ] ; then

  printf "\nSDK versions:\n"
  ls -1 $DOTNET/sdk

  printf "\nInstalled runtime versions:\n"
  ls -1 $DOTNET/shared/Microsoft.NETCore.App

  printf "\nFramework host versions:\n"
  ls -1 $DOTNET/host/fxr
fi

will list installed .NET Core SDK, runtime, and Framework Host versions installed on a Mac.

If you run dotnet --info from the commandline you will see the default SDK version. You can change what SDK version to use by adding a section in the global.json file. The dotnet executable will look for such a file in the root folder of your project.

The format of the global.json looks like

{
  "sdk": {
    "version": "1.0.4"
  }
}

If you now run dotnet --info you should see:

tmp ➜ dotnet --info
.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4

Please create issues at the Github repo Twitter.

Edit page on GitHub. Please help me to improve the blog by fixing mistakes on GitHub. This link will take you directly to this page in our GitHub repository.

There are more posts on the front page.

Creative Commons License
Content of this blog by Carsten Jørgensen is licensed under a Creative Commons Attribution 4.0 International License.