sdk: dotnet: command not found Mac OS X 10.11.4, dotnet-osx-x64.1.0.0-rc2-3002702.pkg

Steps to reproduce

  1. Run the latest released .NET Core pkg installer: dotnet-osx-x64.1.0.0-rc2-3002702.pkg.
  2. Pull up a fresh instance of your preferred shell.
  3. Run dotnet

Expected behavior

dotnet executes and probably prints usage information because no specific command was passed.

Actual behavior

I’m given this output:

zsh: command not found: dotnet

Environment data

dotnet --info output:

shawn ~  dotnet --info
zsh: command not found: dotnet

¯_(ツ)_/¯

normandy:~ shawn$ /usr/local/share/dotnet/dotnet --info
.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.11
 OS Platform: Darwin
 RID:         osx.10.11-x64

This package was found at https://go.microsoft.com/fwlink/?LinkID=798388, and was not the link specified at the actual instruction guide at https://www.microsoft.com/net/core#macosx.

Verifying the hash:

shawn ~ shasum ~/Downloads/dotnet-osx-x64.1.0.0-rc2-3002702.pkg -a 512
5f00fd91e1bbffe55d091c398913847bab0766ab00987d9164826a1c15f2b05eb8b56f801c0625b75161237dd31eb9180b6468b2bbd9c85077caf2fb4cae6e7a  /Users/shawn/Downloads/dotnet-osx-x64.1.0.0-rc2-3002702.pkg

It’s also worth mentioning that dotnet does, in fact, exist at /usr/local/share/dotnet/dotnet, but there’s definitely no symlink in /usr/local/bin/. While there’s definitely no symlink, the more I read about this issue, the more it seems like that’s intentional. This is most likely actually a duplicate of dotnet/sdk#5193 and highlights the insufficiency of using path_helper for zsh users.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@wenjiangtao The quick fix is to just run ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/, which will get you a working dotnet, but doesn’t change the fact that adding the entry for dotnet in /etc/paths.d/ doesn’t seem to work well for zsh users.

@dasMulli I haven’t made any symlinks to the dotnet binary before, and there was nothing referencing it in /usr/local/bin/ at that point.

Also, in reference to that issue, I think the more sensible option would be to just create a symlink in /usr/local/bin/ - it’s very likely to already be part of a user’s PATH since the project requires you to have brew set up and the latest openssl installed. It seems like zsh doesn’t use path_helper by default, or at least, not in the way that the dotnet maintainers expect it to.

@flyingsky I’m not sure if the installer actually added a symlink to /usr/local/bin/ or if zsh actually runs path_helper on your system, but I was definitely not able to run dotnet after opening a new shell or a new instance of zsh. Or maybe I shouldn’t assume you’re a zsh user, haha.

Adding /usr/local/share/dotnet to the PATH in .zshrc fixed the problem in my case

# Add .NET to $PATH
export PATH="/usr/local/share/dotnet:$PATH"

@blackdwarf Good catch! I also found a similar offending line in my .zshrc:

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin"

At this point, it’s been so long since I set up zsh on my machine that I honestly can’t remember what’s responsible for that line in there, but oh-my-zsh is definitely a likely culprit. To resolve the issue on my end, I’ve changed the export to this:

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:$PATH"

Which then allows me to do this:

shawn ~ which dotnet
/usr/local/share/dotnet/dotnet

Cheers!

I ran into the same issue. I’m using oh-my-zsh. Here’s the relevant portion of my ~/.zshrc:

# User configuration

export PATH="/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin"

Manually creating the symlink to /usr/local/bin/ fixed it for me.

Thanks!