Skip to content

dotnetup default macOS install path (~/Library/Application Support/dotnetup/dotnet) contains a space and breaks Android AOT, WASM AOT, and iOS Run targets #57369

Todo

Description

@mattleibow

Summary

On macOS, dotnetup installs the .NET SDK and workload packs under ~/Library/Application Support/dotnetup/dotnet by default. Because Application Support contains a space, any SDK target, workload wrapper script, or native AOT tool that invokes a path via sh without quoting fails with No such file or directory (/Users/<user>/Library/Application: No such file or directory or /Users/<user>/Library/as: No such file or directory).

While individual workload scripts/tools should quote paths properly, having a space in the default DOTNET_ROOT on macOS breaks standard out-of-the-box .NET workflows across Android, MAUI, WebAssembly, and iOS. Using a space-free default path on macOS (for example ~/.dotnetup/dotnet next to the dotnetup binary at ~/.dotnetup/dotnetup, or ~/.local/share/dotnetup/dotnet) would avoid this entire class of failures, while the underlying workload tools are also fixed to quote paths with spaces.


Concrete Failures Triggered by ~/Library/Application Support/dotnetup/dotnet

1. Android Release / AOT builds fail in Microsoft.Android.Sdk.Darwin binutils wrapper scripts

Building any Android or .NET MAUI Android project in Release configuration (where Mono AOT is enabled by default) fails when running the binutils wrapper scripts under packs/Microsoft.Android.Sdk.Darwin/<version>/tools/Darwin/binutils/bin/:

  • aarch64-linux-android-as
  • aarch64-linux-android-ld
  • aarch64-linux-android-strip
  • arm-linux-androideabi-as / ld / strip
  • i686-linux-android-as / ld / strip
  • x86_64-linux-android-as / ld / strip

Each wrapper script contains an unquoted $(dirname $0):

#!/bin/bash -e
MY_NAME="$(basename $0)"
MY_DIR="$(cd $(dirname $0);pwd)"

exec "${MY_DIR}"/as @gas-arch=${MY_NAME} "$@"

Because $(dirname $0) is unquoted, bash word-splits /Users/<user>/Library/Application Support/dotnetup/... into /Users/<user>/Library/Application and Support/..., causing cd to land in /Users/<user>/Library (or fail) and producing:

Microsoft.Android.Sdk.Aot.targets(123,5): error : /Users/<user>/Library/Application Support/dotnetup/dotnet/packs/Microsoft.Android.Sdk.Darwin/36.1.118/tools/Darwin/binutils/bin/aarch64-linux-android-as: line 5: /Users/<user>/Library/as: No such file or directory
Microsoft.Android.Sdk.Aot.targets(123,5): error : AOT of image obj/Release/net10.0-android/android-arm64/linked/SkiaSharp.dll failed.

2. WebAssembly AOT (RunAOTCompilation=true) fails in mono-aot-cross (compile-in-child and llvm-path)

Publishing any Microsoft.NET.Sdk.WebAssembly or Microsoft.NET.Sdk.BlazorWebAssembly project with <RunAOTCompilation>true</RunAOTCompilation> fails in _WasmAotCompileApp (WasmApp.Common.targets):

  1. WasmApp.Common.targets passes compile-in-child (on non-Windows) and LLVMPath="$(_WasmLLVMPathForAOT)" to MonoAOTCompiler.
  2. When compile-in-child is enabled, mono-aot-cross spawns child processes via sh -c without quoting its own executable path (~/Library/Application Support/dotnetup/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.browser-wasm/<version>/tools/mono-aot-cross).
  3. mono-aot-cross also invokes LLVM tools (opt / llc) under llvm-path=/Users/<user>/Library/Application Support/dotnetup/dotnet/packs/Microsoft.NET.Runtime.Emscripten.<version>.Sdk.osx-arm64/<version>/tools/bin/ via sh -c without quoting the path.

Both fail with:

WasmApp.Common.targets(672,5): error : Precompiling failed for obj/Release/net10.0/wasm/for-publish/aot-in/System.Private.CoreLib.dll with exit code 1.
WasmApp.Common.targets(672,5): error : Executing: /Users/<user>/Library/Application Support/dotnetup/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.browser-wasm/10.0.15/Sdk/../tools/mono-aot-cross "--wasm-exceptions" "--debug" "--llvm" "--aot=no-opt,static,direct-icalls,deterministic,_child,mattr=simd,nodebug,llvm-path=/Users/<user>/Library/Application Support/dotnetup/dotnet/packs/Microsoft.NET.Runtime.Emscripten.3.1.56.Sdk.osx-arm64/10.0.15/tools/bin/,..."
WasmApp.Common.targets(672,5): error : sh: /Users/<user>/Library/Application: No such file or directory

3. Emscripten native relinking (WasmBuildNative=true) wrapper scripts

In Microsoft.NET.Runtime.Emscripten.*.Sdk.osx-arm64 (e.g., 10.0.14), wrapper scripts in tools/bin/clang used unquoted CLANG_CC=$(dirname $0)/clang-19, failing when WasmBuildNative=true:

.../tools/bin/clang: line 25: /Users/<user>/Library: No such file or directory

4. Apple dotnet build -t:Run (RunCommand unquoted in <Exec>)

Tracked in #57310 / #54917: Microsoft.Sdk.Mobile.targets sets <RunCommand>$(MlaunchPath)</RunCommand> (pointing into ~/Library/Application Support/dotnetup/dotnet/packs/Microsoft.iOS.Sdk.../tools/bin/mlaunch) and Microsoft.NET.Sdk.targets runs <Exec Command="$(RunCommand) $(RunArguments)" /> without quotes, failing with:

/Users/<user>/Library/Application: No such file or directory

Recommendations

  1. Change dotnetup's default macOS install root to a path without spaces (for example ~/.dotnetup/dotnet, alongside ~/.dotnetup/dotnetup, or ~/.dotnet/dotnetup), and support persisting custom install paths in dotnetup config (dotnetup: Support custom dotnet roots #55346).
  2. Fix the unquoted paths in the workload packs/tools so SDK paths with spaces also work:
    • Quote "$(dirname "$0")" in Microsoft.Android.Sdk.Darwin's tools/Darwin/binutils/bin/* wrapper scripts (dotnet/android).
    • Quote the child compiler and llvm-path command invocations in mono-aot-cross (dotnet/runtime).

Activity

  1. added
    untriaged
    on Nov 26, 2026
  2. mattleibow commented on Nov 26, 2026

    @mattleibow
    MemberAuthor

    One additional note on why a symlink workaround (such as /usr/local/share/dotnet -> ~/Library/Application Support/dotnetup/dotnet) does not avoid this: the native dotnet host resolves symlinks via realpath() on its own executable path when computing the SDK root, so Base Path / $(NetCoreRoot) and all workload pack paths resolved by MSBuild still expand to /Users/<user>/Library/Application Support/dotnetup/dotnet/... with the space even when invoked via /usr/local/share/dotnet/dotnet.

  3. locked and limited conversation to collaborators on Nov 26, 2026
  4. unlocked this conversation on Nov 26, 2026
  5. added
    Area-dotnetup
    and removed
    untriaged
    on Nov 26, 2026
  6. github-actions commented on Nov 26, 2026

    @github-actions
    Contributor

    🎯 Agentic Issue Triage

    Triage Assessment:

    • 🏷️ Labels: Area-dotnetup Work items around the proposed `dotnetup` bootstrapper/toolchain management tool and library Bug
    • 💻 Assignment: @nagilson | @dotnet/dotnetup
    • 🟩 Confidence: high - The issue directly concerns dotnetup default install path, matching the Area-dotnetup CODEOWNERS section.

    Similar issues: #57310 (potentially related) #55346 (potentially related)

    ➡️ Summary: dotnetup's default macOS install path contains a space, breaking Android AOT, WASM AOT, and iOS Run workflows. Consider a space-free default root while workload tools fix path quoting.

    Generated by 🏷️ Issue Triage for #57369 · copilot · auto (Claude Sonnet 5.5) · ~17 AIC · ⌖ ~2 AIC · ⊞ 15.5K · ◷

  7. M-Yankov commented on Dec 4, 2026

    @M-Yankov

    Yesterday this was automatically updated from Visual Studio Code extensions (C# Dev Kit) and no longer able to run the >NET MAUI project (.NET 10). It was working fine before the update and then strange errors appeared (command not recognized), even dotnet build fails. According to the copilot the path passed to the command line internally by the tool is not escaped, but the problem is somewhere else. Why (and who) decided to install dontnet for MAC OS in that directory by default???? it should be as in the image:

    install-Path-for-mac

    from that that article https://learn.microsoft.com/en-us/dotnet/core/install/how-to-detect-installed-versions?pivots=os-macos

  8. M-Yankov commented on Dec 4, 2026

    @M-Yankov

    The errors I've got:

     localadmin@MacBookPro TelemetryExporter.UI % dotnet build
    Restore complete (1.4s)
    TelemetryExporter.Core net10.0 succeeded (2.8s) → /Users/localadmin/
    developer/TelemetryExporter/TelemetryExporter.Core/bin/Debug/net10.0/
    TelemetryExporter.Core.dll
    TelemetryExporter.UI net10.0-maccatalyst26.2 maccatalyst-x64 failed with 2
    error(s) and 6 warning(s) (5.3s) → bin/Debug/net10.0-maccatalyst26.2/
    maccatalyst-x64/TelemetryExporter.UI.dll
    
    (Removed warnings)
    
    ILLink : error IL1015: Unrecognized command-line option: 'Support/dotnetup/
    dotnet/packs/Microsoft.MacCatalyst.Sdk.net10.0_26.2/26.2.10233/tools/
    TrimAttributes.LinkDescription.xml'.
    /Users/localadmin/.nuget/packages/microsoft.net.illink.tasks/10.0.15/build/
    Microsoft.NET.ILLink.targets(103,5): error NETSDK1144: Optimizing assemblies
    for size failed.
    Build failed with 2 error(s) and 6 warning(s) in 10.3s
    

    Where it started

    CSahrpDoctor

    as I mentioned previously from VS Code an extension C# Dev Kit using for running MAUI projects showed this pop-up with the message requiring to update missing sdk version, ok fair enough. But it used the dotnetup and installed the sdks in default directory for MAC ~/Library/Application Support/dotnetup/dotnet (I still keep my opinion that this default directory is wrong, because of the containing space documentation)
    Also notice the error of the screenshot in technical details that the extension point to that directory too... Meanwhile I already installed the latest SDK version but in different directory. "/user/share/local/dotnet/sdk"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Area-dotnetupBug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions