Personally, It has been a bit frustrating working with multiple .NET core SDKs on the M1, especially when you use dotnet cli commands a lot.
Installing .NET 5 and .NET 6 creates two folders /usr/local/share/dotnet/x64/sdk and /usr/local/share/dotnet/sdk respectively and executing the dotnet commands on the cli can be annoying. If .NET 5 takes precedence on the cli you can't run a command for .NET 6 unless you specify the full path and then the command.
I use ITerm2, ZSH and Oh my Zsh because it has more features and better functionalities than the default terminal and you can set this up using this amazing post below:
- Open the zshrc file using the command below and if you don't have the file you can use the link above to create one
- Create a permanent alias for the dotnet directory path that's not the default on your terminal. In my case, .NET 5 is the default and to run .NET 6 commands easily, add the below to your .zshrc file
dotnet6 can be any name you want and /usr/local/share/dotnet/dotnet is the path that targets .NET 6.
- Restart the terminal and then run