I experience a strange problem with the X tool on dotnet 6 on Macs with an Apple Silicon M1 / M2 processor. This does NOT happen on Intel MACs.
So here is the problem (X seems not to find the installed SDK):
[tools] x
You must install .NET to run this application.
App: /Users/tbednarz/.dotnet/tools/x
Architecture: x64
App host version: 7.0.2
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.13-x64&apphost_version=7.0.2
I run .NET6 on the MAC:
[tools] dotnet --info
.NET SDK:
Version: 6.0.401
Commit: 0906eae6f8
Laufzeitumgebung:
OS Name: Mac OS X
OS Version: 13.1
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.401/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: arm64
Commit: 163a63591c
.NET SDKs installed:
6.0.401 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
[tools]
And in my PATH I have both, the SDK and the TOOLS:
Interesting is, that the path to tools appears twice, once expanded and once with the ~ for the home folder. This sometimes does not work correctly. So I added the expanded tools path in my .zshrc file. I do NOT know where the other one is coming from, I did not set it.
Does anybody have some experience with the apple silicon macs and how to get the x tool working?
Yes of course, I didn’t miss the -a architecture parameter. Installation also worked without error.
To me it looks like the x tool is not parsing the path correctly, at least thats what the error message implies. It should find /usr/local/share/dotnet where the executable dotnet file is stored. I can call dotnet in every shell and its being found immediately.
Please have a look at the following two statements:
[dotnet] dotnet tool list
Paket-ID Version Befehle Manifest
------------------------------------------------
[dotnet] dotnet tool install -g -a x64 x
Das Tool "x" ist bereits installiert.
list does not show any installed tool but if I try to (re-)install x it says it is already installed. That is very strange but looks to me like a path problem somewhere… The two commands seem to look in different places.
The management of tool paths are handled by dotnet SDK, not by individual tools.
We don’t have access to M1 to test, but looking at this reddit thread you may need to use the x64 dotnet binary to install x64 dotnet tools (/usr/local/share/dotnet/x64/dotnet).
My dotnet --info also shows, that I am using a plain arm64 version of the dotnet 6 SDK. I can also run and debug my servers correctly using the latest version of JetBrains Rider.
dotnet tool install -g -a x64 x which seems to force the use of Rosetta.
This leads me to the question: Do you need to build the x tool architecture specific (arm64 / X64)?
And Rosetta is not the best option to use (it is like an emulator), and I am pretty sure it does not work well if you mix arm64 SDK with X64 code, e.g. loading DLLs built for X64. According to my /etc/hosts folder, arm64 seems to be the correct default architecture.
So if you need arm64 builds and do not have a Mac with M1 or M2 chips, let me know if I can be of any help. I have an M2 MacBook Air and an MacStudio with M1 Ultra chip and tons of RAM beside my intel based Macs.
@mythz: OK I think you should update your documentation.
If you have a plain vanilla arm64 SDK installation on a MAC with M1 or M2 processor, you can run the same command as on Intel Macs (or Linux or Windows):
dotnet tool install --global x
Now one can call x without any error. However for whatever reasons, dotnet tool list does not show x in the list.
[~] dotnet tool list
Paket-ID Version Befehle Manifest
------------------------------------------------
[~]
But x seems to work:
[~] x
Version: 6.0.9
Usage:
x new List available Project Templates
x new <template> <name> Create New Project From Template
x download <user>/<repo> Download latest GitHub Repo Release
x get <url> Download URL to file (-out <file|dir>)
x stream <url> Stream URL contents to console stdout
...etc
The -a x64 option may be required for SDKs prior to V6 (including Core 3.1) since these require Rosetta (Dont know if that was working sometime in the past). But SDKs V6 and later can be downloaded as plain vanilla arm64 builds.