sdk: dotnet: command not found mac OS X, dotnet-osx-x64.1.0.0.001598.pkg

Steps to reproduce

Install .NET Core with OSX 10.11 installer: dotnet-osx-x64.1.0.0.001598.pkg open mac terminal: type dotnet

symbolic links missing on post-installation

Creating links with the following fixes the issue. ln -s /usr/local/share/dotnet/bin/dotnet /usr/local/bin/ ln -s /usr/local/share/dotnet/bin/csc /usr/local/bin/

Expected behavior

dotnet command runs with command line options that have been chosen.

Actual behavior

-bash: dotnet: command not found

Environment data

dotnet --info output:

None because dotnet command not found.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 20
  • Comments: 58 (6 by maintainers)

Most upvoted comments

I fix it with this command line: ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

Actually after install, i need open new terminal to run command. Then it works. Do NOT add symlink manually.

@flyingsky opening a new terminal worked, thanks!

Still Broken as of 3/19/2017, fixed with:

ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

same even with latest build, “dotnet: command not found”

Wow…surprising that this is still an issue since 2016 (that you have to run ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/).

They should at least add it to the install instructions.

i closed my terminal and re-opened. it is working now.

Adding dotnet to my PATH resolved the issue (High Sierra) export PATH=/usr/local/share/dotnet:$PATH

@blackdwarf From what I understand the installer is doing something with /etc/local/paths.d/ to get dotnet on the PATH which requires closing and opening the terminal window. This is not mentioned in the installation instructions: https://www.microsoft.com/net/core#macos. It seems it doesn’t work in all cases: https://github.com/dotnet/core/blob/master/cli/known-issues.md#users-of-zsh-z-shell-dont-get-dotnet-on-the-path-after-install. Would it make sense to replace /etc/local/paths.d/ in the installer with ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/ in the installation instructions? I recently setup CI. There was no way for me to ‘close and open the terminal’ so I created the symlink.

I’m surprised that nobody mentioned the path_helper introduced in recent macOS. path_helper respects /etc/paths.d/dotnet, in which is the /usr/local/share/dotnet/dotnet binary add the following line to your shell profile

eval `/usr/libexec/path_helper -s`

@blackdwarf Ok - I think restarting Terminal fixes this error. Just tested it without the symlink after restarting terminal and it seems ok. Maybe it was written in the instructions somewhere, but I must have skipped it 😢

Just installed latest dotnet-dev-osx-x64.1.0.0-preview2-003131.pkg from https://www.microsoft.com/net/core#macos on El Capitan and dotnet was still not in the path (even after restarting Terminal). Manually adding the symlink resolved it.

Not sure why this is closed =/, 4 years on it’s still an issue (the accepted solution does work).

VS Code instructions tell you to use the installer package and it doesn’t setup the path properly for you or symlink it to /bin.

Homebrew is a better option but it’s not what the prompt in vs code tells you to do…

I had the same issue with dotnet-sdk-2.1.300-osx-gs-x64.pkg installing to /usr/local/share/dotnet and not modifying the PATH.

High Sierra 10.13.3, using Bash. Creating the symlink ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/ fixes this issue.

echo $PATH /Users/samyun/chromedriver:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/samyun/.npm-global/bin

ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/ tells me “File exists”, however the dotnet command still returns -bash: dotnet: command not found

Restarting the terminal also, does not work

Same thing happened with MacOs Sierra, using default Terminal and dotnet-dev-osx-x64.1.0.0-preview2-003148.pkg. Had to manually link to: ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

I am using oh-my-zsh and manually symlinking makes it work.

Experienced this today on macOS, using the instructions here: https://www.microsoft.com/net/learn/get-started/macos

Resolution was as mentioned above:

ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

CLI version info:

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

Yeah, same here. Just needed to close terminal and re-open after installing .net core.