I am trying to install .NET 6 and 7 on my Mac (M1 chip) and after trying several approaches, I am going nowhere.
Option-1: Using brew
/opt/homebrew/Cellar/dotnet/7.0.100 which is good./opt/homebrew/Cellar/dotnet@6/6.0.114When I run dotnet --list-runtimes then I only see 7.0.0.
Microsoft.AspNetCore.App 7.0.0 [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.0 [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.NETCore.App]
I get that brew command creates dotnet@6.
How can I have this with .NET 7 so that I don't run into You must install or update .NET to run this application. error?
Option-2: Using Install-scripts.
.NET Runtime 6.0.20).chmod +x dotnet-install.sh
sudo ./dotnet-install.sh --runtime dotnet --version 6.0.20 --install-dir /opt/homebrew/Cellar/dotnet
sudo ./dotnet-install.sh --runtime aspnetcore --version 6.0.20 --install-dir /opt/homebrew/Cellar/dotnet
dotnet --list-runtimes again, then it just showed 7.0.0. Here, I was expecting the above command to create a new folder, like 6.0.20 similar to 7.0.100 but it didn't. All files were directly installed under dotnet folder.Option-3-Using Installers and SDK and Runtime which installs successfully, but I end up seeing 7.0.0 only.
My end goal is to fix the following error: How to fix this?
You must install or update .NET to run this application.
App: /Users/USERNAME/.dotnet/tools/.store/dotnet-ef/6.0.14/dotnet-ef/6.0.14/tools/net6.0/any/tools/netcoreapp2.0/any/ef.dll
Architecture: arm64
Framework: 'Microsoft.NETCore.App', version '6.0.0' (arm64)
.NET location: /opt/homebrew/Cellar/dotnet/7.0.100/libexec/
The following frameworks were found:
7.0.0 at [/opt/homebrew/Cellar/dotnet/7.0.100/libexec/shared/Microsoft.NETCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=arm64&rid=osx.13-arm64
Additional Info:


I'm using homebrew-dotnet-sdk-versions
brew tap isen-ng/dotnet-sdk-versions
brew install --cask dotnet-sdk6-0-400
dotnet --list-sdks
This way multiple versions can be used in parallel.
In your .net code you might need to define which version to use in a file called global.json in the root folder:
{
"sdk": {
"version": "6.0.412"
}
}
After spending almost a day and half, I think following approach is easiest one which worked for me:
brew uninstall dotnetResult:
As you can see, /opt/homebrew/Cellar/ is gone now (due to uninstallation) and all .NET versions are coming from user/local/.... path, which is the key. Here, all your future installation will be in this path, so you don't have to worry about it later on.

If you are using .zshrc file then you can set usr/local/share/dotnet:~/.dotnet/tools:$PATH for export PATH=.
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