Skip to content

IOException: Permission denied for CacheOutputDirectory on Mac #723

@Tunied

Description

@Tunied

Hi,

I'm running into an issue when trying to install packages via NuGetForUnity on macOS.

The installation fails with the following error:

IOException: Permission denied

Which occurs at:

Directory.CreateDirectory(CacheOutputDirectory);

Looking into the source code, I see that DetermineCacheOutputDirectory() resolves the cache path like this:

var localApplicationDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
return Path.Combine(Path.GetFullPath(localApplicationDataFolder), "NuGet", "Cache");

On macOS, this resolves to:

/Users/eran/.local/share/NuGet/Cache

(eran is my username.)

However, this directory doesn't exist by default, and attempting to create it programmatically fails due to insufficient permissions.

To resolve the issue, I had to manually:

  • Create the directory
  • Grant read/write permissions to everyone on that folder

I'm not sure whether this is a macOS-specific issue or something more general, but it might be worth mentioning in the documentation or installation guide. Hopefully this can help others running into the same problem.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions