Where apps hide your files
Two separate places matter for .NET on a Mac: the SDK itself, which the installer puts in a system folder, and the NuGet package cache in your home folder, which is the part that grows.
/usr/local/share/dotnet
Microsoft's macOS install guide says that on an Arm-based Mac the Arm64 SDK installs to this normal folder, and that the x64 SDK, if you install that too, goes into a separate x64 subfolder with its own dotnet command, which is not on your PATH:
/usr/local/share/dotnet/x64/dotnet
The dotnet command is found on your path, so the quickest way to see where it really resolves is:
which dotnet
dotnet --info
dotnet --info prints the SDK and runtime versions and the base path in use. The .NET SDK was not installed on the Mac used for this guide, so the paths here come from Microsoft's documentation rather than a local listing. To open the folder, press ⇧⌘G in Finder and paste the path, or run open /usr/local/share/dotnet.
The folder holds the host program and a few subfolders. Their names are stable across releases, though the version folders inside them change.
| Folder | What it holds |
|---|---|
sdk/<version> | One folder per installed SDK, for example the 9.0 or 10.0 line. |
shared/Microsoft.NETCore.App/<version> | The .NET runtime used to run apps. |
shared/Microsoft.AspNetCore.App/<version> | The ASP.NET Core runtime, which comes with the SDK. |
host/fxr/<version> | The host resolver that picks an SDK and runtime. dotnet --info does not list it. |
packs, templates | Targeting packs and the project templates behind dotnet new. |
Installing the SDK also installs the matching runtime and ASP.NET Core runtime, according to Microsoft. To list what you have without browsing folders:
dotnet --list-sdks
dotnet --list-runtimes
There are other ways to install .NET, and each lands in a different place:
/usr/local/share/dotnet, as above.dotnet-install.sh script: ~/.dotnet by default, per Microsoft's guide. You then add it to your PATH and set DOTNET_ROOT yourself.~/Applications/.dotnet.dotnet-sdk cask runs Microsoft's installer package, so it lands in /usr/local/share/dotnet as above, even on Apple silicon. The dotnet formula is different: it installs under the Homebrew prefix, in /opt/homebrew/opt/dotnet/libexec on Apple silicon, and its caveats suggest setting DOTNET_ROOT to that folder.If dotnet is not found in a new Terminal window after a script or manual install, the folder is not on your PATH. Microsoft's fix is two lines in your shell profile, such as ~/.zshrc:
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
Use your own install folder in place of $HOME/.dotnet if you put it elsewhere.
This is where the disk space goes. According to the NuGet documentation, on macOS the folders are:
| Folder | Default path |
|---|---|
| global-packages | ~/.nuget/packages |
| http-cache | ~/.local/share/NuGet/v3-cache |
| plugins-cache | ~/.local/share/NuGet/plugins-cache |
| temp | $TMPDIR/NuGetScratch |
All of the home-folder ones are hidden dot-folders. Print the real paths on your Mac:
dotnet nuget locals all --list
Every package a project restores is expanded into ~/.nuget/packages, one folder per package ID and version. Projects share that folder instead of keeping their own copy, so it only grows as you try new packages and versions. See the total with du -sh ~/.nuget/packages.
bin and obj inside each project folder hold that project's build output and restore files. They are safe to delete, and the next build recreates them, which is the quickest way to shrink a project you have finished with.~/.dotnet/tools is where global tools from dotnet tool install -g are placed, according to Microsoft's tool documentation. It is also what the two PATH lines above add for script installs.dotnet new templates you install are kept in your home folder, in a hidden folder created by the template engine. Run dotnet new uninstall to see and remove them instead of hunting for files.Set the NUGET_PACKAGES environment variable to put global-packages somewhere else, such as an external drive. The NUGET_HTTP_CACHE_PATH variable does the same for the HTTP cache. The NuGet docs list both.
To clear the caches the supported way, close your IDE and run:
dotnet nuget locals http-cache --clear
dotnet nuget locals global-packages --clear
The first is cheap: it holds copies of feed responses, and NuGet typically treats entries older than 30 minutes as expired. The second deletes every downloaded package, so each project must restore, and download, its packages again on the next build. Both are safe, just slow if you are offline.
Microsoft's uninstall guide removes .NET one version folder at a time and recommends against deleting the whole dotnet folder. List what you have with dotnet --list-sdks, then remove the folder for the version you no longer need. This is destructive and asks for your password, so check the version number twice. For an SDK numbered 8.0.100, for example:
sudo rm -rf /usr/local/share/dotnet/sdk/8.0.100
Runtimes are removed the same way from shared/<product>/<version>. Microsoft also publishes the .NET Uninstall Tool (dotnet-core-uninstall) for this job. A script install under ~/.dotnet can simply be moved to the Trash.
Spotlight and Finder searches leave out /usr/local/share, hidden folders such as ~/.nuget, and most package contents. Package folders are also named after the package ID, like newtonsoft.json, in lower case.
Everywhere indexes hidden dot-folders and system locations, so typing newtonsoft shows that package's folder inside ~/.nuget/packages, and typing dotnet lists every dotnet and .dotnet folder, whichever install route you used. Press ⌘↵ to reveal a result in Finder. It matches names only, so use dotnet --list-sdks for versions.
With the official installer (or Homebrew's dotnet-sdk cask), in /usr/local/share/dotnet. The x64 SDK on an Apple silicon Mac goes into its x64 subfolder, and the install script defaults to ~/.dotnet.
In ~/.nuget/packages, a hidden folder. Run dotnet nuget locals global-packages --list to print the path your setup uses.
Run dotnet nuget locals all --clear, or clear one folder, such as http-cache or global-packages. Packages are downloaded again on the next restore.
Run dotnet --list-sdks and dotnet --list-runtimes, or look at the sdk and shared folders inside the dotnet folder.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised