What is the path to .NET Core SDK on macOS

I thought I’d look into C# development for a bit, and the first hurdle I came across is that I didn’t know the path to the .NET framework when I tried it out on my Mac. I did some digging and found that after installing it from here, the framework (SDK and Core Runtime) are installed here:


Super! I should now be able to call the dotnet command from a Terminal window, but for that I need to add that path to my $PATH variable. Yes… how do I do that again…?

Adding dotnet to your local PATH on macOS

You’d think that after working with Mac and Linux for over 10 years, and being confident on the command line, I’d remember something as trivial as this – but I frequently forget. Sigh! Best write it down somewhere. Here’s a good place, before I make this a separate note.

To see what’s in the current path, we can do this:

echo $PATH

This will give is a (more or less) long string of paths that our shell will traverse before giving up with “command not found”. To add to this long list, we should copy it, then add a path of our choice, separated by a colon. Like this:

export PATH=$PATH:/current/path:/new/addition/to/path

For dotnet, we want to add the path to the command, not the actual command. Hence we need to do this:

export PATH=$PATH:/current/path:/usr.local/share/dotnet

Now we should be able to type dotnet anywhere in our Terminal session and get something like this (rather than “command not found”):


Usage: dotnet [options]
Usage: dotnet [path-to-application]
-h|--help Display help.
--info Display .NET Core information.
--list-sdks Display the installed SDKs.
--list-runtimes Display the installed runtimes.
The path to an application .dll file to execute.

Let the fun begin!

You can leave a comment on my original post.