So I downloaded NET Core 2.1 SDK for mac and installed it. But when I run the dotnet
command from terminal it throws -bash: dotnet: command not found
error.
I am trying to use the dotnet new react
to spin up a new .Net Core/React project.
How can I fix this? Thanks!
Path differences NET are installed to the normal /usr/local/share/dotnet/ folder. However, when you install the x64 version of . NET 6 SDK, it's installed to the /usr/local/share/dotnet/x64/dotnet/ folder.
Make sure your macOS version meets the prerequisites
https://docs.microsoft.com/en-us/dotnet/core/macos-prerequisites?tabs=netcore2x
If it does, then after installing via the installer, in a new terminal run this command
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
Then try dotnet --version
hopefully that should work
EDIT:
You might need to add x64
like so:
ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
Courtesy of Stan in the comments
For Mac M1
sudo ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/
If you add symbolic link to /usr/local/bin/ but you get file exist error.
You can delete the dotnet file at /usr/local/bin/
or
at you finder Shift + ⌘ Command + G and type /usr/local/bin/ , delete the dotnet file in finder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With