- Published on
Running .NET x64 under Rosetta on ARM64 Macs
- Authors
- Name
- Jac Timms
Running .NET x64 under Rosetta on ARM64 Macs.
I wanted to run Microsoft.CognitiveServices.Speech.CLI on an ARM64 Mac, but it requires .NET 6 x64. Here is the workaround I used to get it working.
Initial Setup
- First, install Rosetta:
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
- Duplicate iTerm.app (install it first if you don't have it) and name it iTermRosetta.app, right click iTermRosetta.app & "Get Info", check "Open in Rosetta".
Important Note About Installation Methods
While you can use Homebrew to install .NET, I recommend against it if you want to run both ARM64 and x64 versions side by side. Using the official Microsoft installers gives you more control over the installations and prevents potential conflicts.
Installing .NET SDK (x64) for Rosetta
- Download and install .NET 6 SDK for x64:
curl -O https://download.visualstudio.microsoft.com/download/pr/82d434e3-1910-40be-bf9e-a4ed5439d336/259a9d70a9bc501a73d167fa473e8fda/dotnet-sdk-6.0.427-osx-x64.pkg
sudo installer -pkg dotnet-sdk-6.0.427-osx-x64.pkg -target /
- Set up environment variables in your Rosetta terminal (add to ~/.zshrc):
export DOTNET_ROOT=/usr/local/share/dotnet/x64
export PATH="/usr/local/share/dotnet/x64:$PATH"
- Install the Speech CLI:
dotnet tool install --global Microsoft.CognitiveServices.Speech.CLI
Installing .NET SDK (ARM64) for Native Terminal
If you want to maintain both x64 and ARM64 versions, you can install the ARM64 version in your native terminal:
- Download and install .NET 8 SDK for ARM64:
curl -O https://download.visualstudio.microsoft.com/download/pr/35b0fb29-cadc-4083-aa26-6cecd2e7ffa1/1a9972a435b73ffdd0b462f979ea5b23/dotnet-sdk-8.0.403-osx-arm64.pkg
sudo installer -pkg dotnet-sdk-8.0.403-osx-arm64.pkg -target /
Verifying the Installation
You should now have:
In your Rosetta terminal (x64):
$ dotnet --info .NET SDK (reflecting any global.json): Version: 6.0.427 Architecture: x64
In your native terminal (ARM64):
$ dotnet --info .NET SDK: Version: 8.0.403 Architecture: arm64
How It Works
The system maintains separate installations:
- ARM64 version in
/usr/local/share/dotnet
- x64 version in
/usr/local/share/dotnet/x64
By setting different DOTNET_ROOT
and PATH
variables in each terminal, we can use the appropriate version for each architecture.
Troubleshooting
If you run into issues where the wrong architecture is being used:
- Check your
DOTNET_ROOT
andPATH
settings - Verify which
dotnet
is being used withwhich dotnet
- Clear the command hash table with
hash -r
Conclusion
This setup allows you to run both ARM64 and x64 .NET applications on your Mac, each in their appropriate environment. The Speech CLI and other x64-only tools will work in the Rosetta terminal, while you can maintain native ARM64 performance for your regular development work.
Remember to always use the Rosetta terminal when working with x64-specific tools and the native terminal for ARM64 development.