Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M1 Apple Monterey: Dotnet tool not found in zsh shell #22588

Open
sshquack opened this issue Nov 14, 2021 · 6 comments
Open

M1 Apple Monterey: Dotnet tool not found in zsh shell #22588

sshquack opened this issue Nov 14, 2021 · 6 comments
Milestone

Comments

@sshquack
Copy link

Describe the bug

Installing VS x64 on M1 Apple silicon macOS Monterey and launching a global tool does not work out of the box.

To Reproduce

❯ tr ':' '\n' <<< "$PATH" | grep dotnet
/usr/local/share/dotnet
~/.dotnet/tools
  • Install any dotnet global tool
dotnet tool install --global dotnet-format
  • Try to run the globally installed tool

Exceptions (if any)

❯ dotnet-format
zsh: command not found: dotnet-format

Further technical details

  • Include the output of dotnet --info
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.402
 Commit:    e9d3381880

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  12.0
 OS Platform: Darwin
 RID:         osx-x64
 Base Path:   /usr/local/share/dotnet/sdk/5.0.402/

Host (useful for support):
  Version: 5.0.11
  Commit:  f431858f8b

.NET SDKs installed:
  3.1.414 [/usr/local/share/dotnet/sdk]
  5.0.402 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
Visual studio 2019
visualstudioformacinstaller-8.10.13.2
  • Zsh version
❯ zsh --version
zsh 5.8 (x86_64-apple-darwin21.0)
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Nov 14, 2021
@sshquack
Copy link
Author

sshquack commented Nov 14, 2021

If ~/.dotnet/tools is in the $PATH, I would have expected the dotnet-format binary located at ~/.dotnet/tools/dotnet-format to have been found. Turns out this is because ~ is not expandable in $PATH?

To confirm this, if I explicitly add export PATH="$HOME/.dotnet/tools:$PATH" zsh was able to find the tool. So it seems like the dotnet installer for mac should add $HOME/.dotnet/tools to $PATH instead of ~/.dotnet/tools

@KalleOlaviNiemitalo
Copy link

Similar problems have been discussed in #22214 and #9415. The .NET SDK installer supposedly displays a message saying how to manually configure PATH for zsh; is that message at all visible when .NET SDK is installed by Visual Studio for Mac?

@sshquack
Copy link
Author

@KalleOlaviNiemitalo There is a message when installing a tool using the CLI dotnet tool install ... but the VS for mac installer does NOT show this. I will add a comment to #22214 because it looks like a similar issue

@jrdodds
Copy link

jrdodds commented Dec 23, 2021

The issue can be reproduced on Intel based macs. It's not an Apple Silicon (aka M1) issue.

@jrdodds
Copy link

jrdodds commented Dec 23, 2021

@sshquack changing the content of the /etc/paths.d/dotnet-cli-tools file from ~/.dotnet/tools to $HOME/.dotnet/tools will not resolve the issue. The paths in the files in /etc/paths.d must be literal paths.

@marcpopMSFT marcpopMSFT modified the milestones: 6.0.3xx, 6.0.4xx Mar 23, 2022
@marcpopMSFT marcpopMSFT modified the milestones: 6.0.4xx, 8.0.1xx Jul 20, 2022
@cicorias
Copy link
Member

cicorias commented Jan 8, 2023

This occurs on Mac arm too (M1/m2) Apple Silicon and with 7.x of the dotnet sdk. Really need to address this as it causes such problems for folks that are putting dotnet on their Macs.

@marcpopMSFT marcpopMSFT modified the milestones: 8.0.1xx, 9.0.1xx Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants