"zsh: command not found: dotnet-svcutil" 升级到 macOS Catalina 后
"zsh: command not found: dotnet-svcutil" after upgrading to macOS Catalina
按照建议将我的 macOS 升级到 10.15 (Catalina) 和 switching from bash to zsh 后,我正在尝试从终端启动 svcutil
(或任何其他 .NET Core 工具),但是我收到以下错误消息:
zsh: command not found: dotnet-svcutil
奇怪,因为在使用 echo $PATH
检查路径时提到了它的位置(~/.dotnet/tools
,默认安装 .NET Core 工具的位置)。我该如何解决?
如前所述 ,zsh 不支持路径中的 ~
。 .NET Core 工具的路径条目在安装期间作为文件 /etc/paths.d/dotnet-cli-tools
添加,路径条目 ~/.dotnet/tools
。将其更改为 $HOME/.dotnet/tools
或 ${HOME}/.dotnet/tools
没有帮助,但将其更改为实际路径(例如 /Users/Glorfindel/.dotnet/tools
)就可以了。
另一种选择是重新安装该工具,例如与
dotnet tool uninstall --global dotnet-svcutil
dotnet tool install --global dotnet-svcutil
安装程序会告诉你以下内容,我没试过:
Tools directory '/Users/Glorfindel/.dotnet/tools' is not currently on the PATH environment variable.
If you are using zsh, you can add it to your profile by running the following command:
cat << \EOF >> ~/.zprofile
# Add .NET Core SDK tools
export PATH="$PATH:/Users/Glorfindel/.dotnet/tools"
EOF
And run zsh -l
to make it available for current session.
You can only add it to the current session by running the following command:
export PATH="$PATH:/Users/Glorfindel/.dotnet/tools"
我遇到了类似的问题,并通过从终端执行以下操作修复了它:
将~/.bash_profile的内容复制到~/.zshrc
- 打开一个终端window并输入
nano ~/.bash_profile
- select 该文件中的代码并复制它
- 打开另一个终端window并输入
nano ~/.zshrc
- 粘贴并保存文件
重新打开 VSCode 应该可以了。它对我有用!
按照建议将我的 macOS 升级到 10.15 (Catalina) 和 switching from bash to zsh 后,我正在尝试从终端启动 svcutil
(或任何其他 .NET Core 工具),但是我收到以下错误消息:
zsh: command not found: dotnet-svcutil
奇怪,因为在使用 echo $PATH
检查路径时提到了它的位置(~/.dotnet/tools
,默认安装 .NET Core 工具的位置)。我该如何解决?
如前所述 ~
。 .NET Core 工具的路径条目在安装期间作为文件 /etc/paths.d/dotnet-cli-tools
添加,路径条目 ~/.dotnet/tools
。将其更改为 $HOME/.dotnet/tools
或 ${HOME}/.dotnet/tools
没有帮助,但将其更改为实际路径(例如 /Users/Glorfindel/.dotnet/tools
)就可以了。
另一种选择是重新安装该工具,例如与
dotnet tool uninstall --global dotnet-svcutil
dotnet tool install --global dotnet-svcutil
安装程序会告诉你以下内容,我没试过:
Tools directory '/Users/Glorfindel/.dotnet/tools' is not currently on the PATH environment variable.
If you are using zsh, you can add it to your profile by running the following command:cat << \EOF >> ~/.zprofile # Add .NET Core SDK tools export PATH="$PATH:/Users/Glorfindel/.dotnet/tools" EOF
And run
zsh -l
to make it available for current session.You can only add it to the current session by running the following command:
export PATH="$PATH:/Users/Glorfindel/.dotnet/tools"
我遇到了类似的问题,并通过从终端执行以下操作修复了它:
将~/.bash_profile的内容复制到~/.zshrc
- 打开一个终端window并输入
nano ~/.bash_profile
- select 该文件中的代码并复制它
- 打开另一个终端window并输入
nano ~/.zshrc
- 粘贴并保存文件
重新打开 VSCode 应该可以了。它对我有用!