https://github.com/dotnet/cli/blob/rel/1.0.0/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
https://stackoverflow.com/a/44089766
To uninstall dotnet core from macOS:
- download dotnet-uninstall-pkgs.sh from https://github.com/dotnet/sdk/blob/main/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
- make dotnet-uninstall-pkgs.sh executable
- execute dotnet-uninstall-pkgs.sh as root (requires superuser privileges to run).
curl -O https://raw.githubusercontent.com/dotnet/sdk/main/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh
chmod u+x dotnet-uninstall-pkgs.sh
sudo ./dotnet-uninstall-pkgs.sh
OR
https://gist.github.com/sandrovicente/5590f5ac993d9d7fef038fd2858efcc3
# delete the dotnet folder under /usr/local/share/dotnet
cd /usr/local/share/dotnet && ls
sudo rm -rf dotnet
# delete the dotnet reference file at /etc/paths.d/dotnet
cd /etc/paths.d && ls
sudo rm dotnet
- install dotnet
- remove existing dotnet link if exists:
cd /usr/local/bin && ls && sudo rm -rf dotnet
- create a new link:
ln -s /usr/local/share/dotnet/x64/dotnet /usr/local/bin/