dotnet/sdk

Unable to run global tools in PowerShell running on macOS

sayedihashimi opened this issue · 6 comments

I tried to execute a global tool from PowerShell running on macOS and the tool was not located. When I run dotnet tool list --global it does show up. When I exit out of PowerShell, and get back into a normal bash prompt, the global tool works fine.

macOS version = 10.14.2

global-tool

Here are the runtime/sdks that I have installed.
image

Can you check your path in powershell? It is possible that for some reason the PATH there is missing the shim location where the global tool exes are located.

cc @wli3

@livarcocc here is my path in PowerShell

/usr/local/microsoft/powershell/6:/opt/local/bin:/opt/local/sbin:/Users/sayedhashimi/.fastlane/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
wli3 commented

It is similar to zsh https://github.com/dotnet/cli/issues/9321 . Powershell does not expand ~ on PATH. The best we could do is detect shell, and print a command, and let user to add it to their profile. Since on Linux only user should edit their bashrc

Customers on the Bot Framework side have run into this too on macs, we have a dotnet based tool which isn’t found when executed inside powershell.

Running this ahead of executing the tool seems to resolve the issue on a session by session basis:

$env:PATH += ":/users/YOUR_USER_NAME/.dotnet/tools"

Can we explore fixing this for powershell scenarios? It working in terminal but then not pwsh is confusing for our customers.

wli3 commented

It is due to above reason, the platform constrain (mac's path_helper does not expend ~). The best we could do is to print instruction to let the user append path.

@wil3 yes, that looks like it is the issue. I have worked around it by appending the full path at the end.