DEV Community

Cover image for Use multiple .NET SDK CLI Commands on Mac M1

Posted on

Use multiple .NET SDK CLI Commands on Mac M1

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:

How to Configure your macOs Terminal with Zsh like a Pro

by Chiamaka Ikeanyi Sometimes, using the default terminal sucks. You want to go out of the ordinary, to add life to the boring terminal and improve your productivity. Z shell [] (Zsh) is a Unix shell built on top of bash (the default shell for macOS) with a large number



  • 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
open ~/.zshrc
Enter fullscreen mode Exit fullscreen mode
  • 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
alias dotnet6="/usr/local/share/dotnet/dotnet"
Enter fullscreen mode Exit fullscreen mode


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
dotnet6 --info
Enter fullscreen mode Exit fullscreen mode

.NET 6 command check
*.NET 6 command check*

.NET 5 command check
*.NET 5 command check*

Top comments (0)