Skip to content

Documentation / Knowledge Base

Enclave fails with "Failure processing application bundle" on macOS

On macOS, Enclave can stop working for a standard user after a command has been run with sudo, because the sudo run created a root-owned directory inside that user's home directory. Removing the directory restores access, and running privileged commands with sudo -H stops it from coming back.

Symptoms

Running an enclave command as a standard (non-root) user fails with:

Failure processing application bundle.
Failed to create directory [/Users/<user>/.net/enclave/<bundle-id>] for extracting bundled files.

The same command succeeds when run with sudo, and ls -ld ~/.net/enclave run as the affected user shows root as the directory's owner.

Cause

Enclave for macOS is built for Intel (x64) processors as a .NET single-file application, and Macs with Apple silicon run the same build through Rosetta. When it starts, it extracts files from its own executable into a directory under $HOME/.net/enclave, unless the DOTNET_BUNDLE_EXTRACT_BASE_DIR environment variable points elsewhere (Microsoft: single-file deployment). Whichever user runs Enclave first creates that directory and owns it.

On macOS, sudo keeps the invoking user's HOME by default (the env_keep settings in /etc/sudoers include HOME). A command such as sudo enclave enrol therefore runs as root but extracts into the standard user's home directory, creating ~/.net/enclave owned by root. Later runs without sudo cannot write inside it and fail with the error above.

Resolution

Remove the root-owned directory

As the affected user, delete the directory. It contains only files extracted from the Enclave executable and is recreated on the next run:

sudo rm -rf ~/.net/enclave

To clean up a different account, such as a build agent's user, use the path from the error message up to and including .net/enclave (for example, /Users/<user>/.net/enclave).

Prevent it recurring

Run privileged Enclave commands with sudo -H. The -H option sets HOME to root's home directory, so root extracts under /var/root and never writes into the user's home directory:

sudo -H enclave enrol

Build agents

Any privileged command run on the agent without -H, including sudo enclave enrol as given in the macOS setup instructions, can cause the error again. To make the pipeline immune, give its non-root Enclave commands their own extraction directory, owned by the agent's user. In Azure DevOps, set the variable at pipeline or job level:

variables:
  DOTNET_BUNDLE_EXTRACT_BASE_DIR: $(Agent.TempDirectory)/enclave-bundles

This example uses the job's temporary directory (Agent.TempDirectory). By default, sudo does not pass DOTNET_BUNDLE_EXTRACT_BASE_DIR to root, so privileged steps never write to the pipeline's extraction directory. Do not run Enclave with sudo -E: it passes the variable through, and root then creates the pipeline's extraction directory itself.


Having problems? Contact us at support@enclave.io or visit our support options.

Last updated October 13, 2026