Determine which version is installed with the command line.
According to Microsoft documentation, we need to remove the SDKs and runtimes separately:
Pay attention to the difference in installed locations between the Intel Mac vs silicon M series chip.
Arm-based mac: /usr/local/share/dotnet/
Intel-based mac: /usr/local/share/dotnet/x64/dotnet/
In this example, I want to remove the .NET 6 RC on an M1 silicon Mac from previous test.
% dotnet --list-runtimes Microsoft.AspNetCore.App 6.0.0-rc.1.21452.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.0-rc.1.21451.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] % dotnet --list-sdks 6.0.100-rc.1.21463.6 [/usr/local/share/dotnet/sdk]
From the example above, we’ll remove all instances.
sudo rm -rf /usr/local/share/dotnet/sdk/$version sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.NETCore.App/$version sudo rm -rf /usr/local/dotnet/shared/Microsoft.AspNetCore.All/$version sudo rm -rf /usr/local/share/dotnet/shared/Microsoft.AspNetCore.App/$version sudo rm -rf /usr/local/share/dotnet/host/fxr/$version
Now you can install the new version for your .NET development.