When running Nx commands inside Claude Code's sandbox mode, you may see errors related to the Nx daemon, plugin isolation, or forked processes failing to communicate. This happens because Claude Code's sandbox (Seatbelt on macOS, bubblewrap on Linux) blocks Unix socket access by default, and Nx relies on Unix sockets for inter-process communication.
The fix
Section titled “The fix”Add allowAllUnixSockets: true to your Claude Code sandbox permissions. You can set this at the project level (.claude/settings.local.json) or user level (~/.claude/settings.json):
{ "permissions": { "allowAllUnixSockets": true }}This grants Nx the ability to create and connect to Unix sockets, which it needs for daemon communication, plugin isolation, and forked task execution.
Why allowAllUnixSockets instead of specific paths
Section titled “Why allowAllUnixSockets instead of specific paths”Claude Code's allowUnixSockets setting accepts specific socket paths, but Nx generates socket paths dynamically using process.pid, a counter, and performance.now(). These paths change on every run and can't be predicted ahead of time. Allowlisting individual paths isn't feasible, so allowAllUnixSockets: true is the recommended approach.
Alternative workarounds
Section titled “Alternative workarounds”If you prefer not to enable blanket Unix socket access, you can disable the Nx features that require sockets. These workarounds come with tradeoffs:
Disable the Nx daemon
Section titled “Disable the Nx daemon”NX_DAEMON=false nx <command>The Nx daemon keeps a persistent process running to speed up repeated operations. Disabling it means Nx starts fresh on every invocation, resulting in slower cold starts (especially in large workspaces).
Disable plugin isolation
Section titled “Disable plugin isolation”NX_ISOLATE_PLUGINS=false nx <command>Plugin isolation runs each plugin in a separate forked process to prevent conflicts between multiple TypeScript compilers, module-level caches, and global state. Disabling it runs all plugins in the main process, which can cause issues in workspaces with plugins that have conflicting dependencies.
Socket path environment variables
Section titled “Socket path environment variables”For advanced use cases, Nx provides environment variables to override where socket files are created:
| Variable | Description |
|---|---|
NX_SOCKET_DIR | Overrides the directory for all Nx sockets (daemon, forked process, and plugin) |
NX_DAEMON_SOCKET_DIR | Legacy alias of NX_SOCKET_DIR. Used only when NX_SOCKET_DIR is not set. Prefer NX_SOCKET_DIR. |
NX_NATIVE_FILE_CACHE_DIRECTORY | Overrides the native file cache path |
These are primarily useful for environments with restricted temp directory access (e.g., certain Docker or CI setups). For Claude Code's sandbox, allowAllUnixSockets: true is simpler and more reliable.