Sdk: dotnet on mac: "-bash: dotnet: command not found"

Created on 10 Oct 2016  Â·  9Comments  Â·  Source: dotnet/sdk

Steps to reproduce

I have Sierra version of OSX on which I tried following the installation instructions a few times.
This is what I get:

 â–·  brew install openssl
Warning: openssl-1.0.2j already installed

 â–·  ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln: /usr/local/lib//libcrypto.1.0.0.dylib: File exists

 â–·  ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
ln: /usr/local/lib//libssl.1.0.0.dylib: File exists

When I use the installer (dotnet-dev-osx-x64.1.0.0-preview2-003131.pkg), it works fine

The path /usr/local/share/dotnet does exist

Expected behavior

When I run "dotnet" command, I expect it to work

Actual behavior

Command dotnet does not work. The terminal says
-bash: dotnet: command not found

Environment data

None

Most helpful comment

This happens because the installation package does not add the dotnet executable location to the PATH environment variable. This issue is mentioned in https://github.com/dotnet/core/blob/master/cli/known-issues.md#users-of-zsh-z-shell-dont-get-dotnet-on-the-path-after-install, but apparently it does not affect only zsh users. You need to add this path manually.

In my case the path was /usr/local/share/dotnet, so I ran (from the command line):

export PATH=/usr/local/share/dotnet:$PATH

All 9 comments

Is this in Sierra?

Yes. This is in Sierra.

This happens because the installation package does not add the dotnet executable location to the PATH environment variable. This issue is mentioned in https://github.com/dotnet/core/blob/master/cli/known-issues.md#users-of-zsh-z-shell-dont-get-dotnet-on-the-path-after-install, but apparently it does not affect only zsh users. You need to add this path manually.

In my case the path was /usr/local/share/dotnet, so I ran (from the command line):

export PATH=/usr/local/share/dotnet:$PATH

Thank you. Running ln -s /usr/local/share/dotnet/dotnet /usr/local/bin from the page in the link you mentioned worked for me.

I have an similar issue, when I try to run

dotnet /path/to/my/dll

I recieve this error:
No executable found matching dotnet-/path/to/my/dll

it looks like take all line as unique command

but the diference is I'm trying to run in to a shell script in os x.

I hope someone can helpe

Thanks.

That happens when the host does not find the actual dll in the path you provided. When that happens, it does not treat the path as a dll and instead passes that to the CLI and the CLI ends up treating it as a command, which it does not find either and you end up with the error message you are seeing.

So, make sure that the path to your dll is correct and that the file actually exists in that location.

I'm back to solve this issue for my app but my paths are ok, I made this lots of times just fail with the new version.

I'm not even on mac and I'm getting this same error.
If the _dotnet /path/to/dllfile.dll --myapparg_ is run by cron, it throws that error. If I just copypaste the same exact line and run it from bash, it executes successfully.

Yes, I just added the dotnet path mentioned above to my .zshrc file, and worked like a charm. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

krwq picture krwq  Â·  3Comments

aguacongas picture aguacongas  Â·  3Comments

joffreykern picture joffreykern  Â·  3Comments

moozzyk picture moozzyk  Â·  3Comments

srivatsn picture srivatsn  Â·  3Comments