WindowsmacOSLinux

Where Does NuGet Store Packages?

Where NuGet keeps the global packages folder on Windows, macOS and Linux, and the dotnet command that prints it.

Last updated

Every NuGet restore lands in one global packages folder shared by all projects: %USERPROFILE%\.nuget\packages on Windows, ~/.nuget/packages on macOS and Linux. Target framework subfolders inside each package mean one download serves every project that references it.

The folder only grows, since uninstalling a project orphans its packages. Clearing it is routine maintenance, not surgery. Builds simply re download what they need, which also makes the folder the first suspect when a restore behaves strangely.

Where NuGet stores this, by platform

Windows
%USERPROFILE%\.nuget\packages

Paste %USERPROFILE%\.nuget\packages into Explorer. Each package gets a versioned subfolder. The NUGET_PACKAGES environment variable moves the whole folder if set, so check it when this path is empty.

macOS
~/.nuget/packages

Shared by .NET SDK, Mono and Visual Studio for Mac installs. Confirm with dotnet nuget locals global-packages --list before scripting anything against the path.

Linux
~/.nuget/packages

Same path and same dotnet command as macOS. CI machines often set NUGET_PACKAGES to a workspace folder to keep the cache inside the build agent.

Frequently asked questions

How do I find my exact global packages folder?

Run dotnet nuget locals global-packages --list. It prints the live folder, which moves when NUGET_PACKAGES is set or NuGetDefaults.Config redirects it. Trust that output over any documented default.

Is it safe to delete the packages folder?

Yes. It is purely a cache: the next build re downloads whatever projects still reference. Run dotnet nuget locals global-packages --clear to empty it in one step, or delete the folder by hand with Visual Studio closed.

Notice an outdated path? Let us know.