Global tools path not discoverable on macOS via `which`
See original GitHub issueSteps to reproduce
- Install .NET Core SDK 2.1+
- Install any global tool
- Run
which
in a Terminal session on macOS to discover the tool’s path
Expected behavior
which
should print the absolute path of where the global tool is installed and finish with an exit code of zero.
Actual behavior
which
fails with a non-zero exit code.
Environment data
My PATH
contains the path to the tools directory:
$ tr ':' '\n' <<< "$PATH" | grep dotnet
/usr/local/share/dotnet
~/.dotnet/tools
Running dotnet --info
prints:
.NET Core SDK (reflecting any global.json):
Version: 2.1.500
Commit: b68b931422
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.500/
Host (useful for support):
Version: 2.2.1
Commit: 878dd11e62
.NET Core SDKs installed:
1.0.1 [/usr/local/share/dotnet/sdk]
2.0.0 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]
2.1.200 [/usr/local/share/dotnet/sdk]
2.1.300 [/usr/local/share/dotnet/sdk]
2.1.401 [/usr/local/share/dotnet/sdk]
2.1.500 [/usr/local/share/dotnet/sdk]
2.2.103 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Troubleshoot .NET tool usage issues
You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Read more >zsh: command not found: dotnet-ef
You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Read more >Making .NET Core Global Tools Work With OhMyZsh
NET Core Global Tools Work With OhMyZsh. To fix this problem, I had to make sure that the . dotnet/tools directory was exported...
Read more >Cannot debug net6.0-macos Apps - Developer Community
You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
Read more >.NET Core 2.1 Global Tools
Tools are user-specific, not machine global NET Core CLI installs global tools to $HOME/. dotnet/tools (Linux/macOS) or %USERPROFILE%\. dotnet\ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s likely covered in some of the related issues, but here’s what worked for me, if anyone else needs a workaround for this issue in zsh.
After you install the SDK, add the global install tools folder to
$PATH
manually.Yes but is that the only experience we are optimising for? It seems odd that while shell can launch, other programs like
which
cannot find global tools and a .NET application cannot launch them. It makes it difficult to write a portable application since “it just works” on Windows.For example, create a new console application with
dotnet new console
and replace content ofProgram.cs
with the following:Next use the program to launch any globally installed tool on macOS, e.g.: