--settings writes cache to shared /tmp/, causing EACCES when two macOS user accounts share a Mac
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When the bundled Claude Code CLI is invoked with --settings <json>, it writes a cache file to
/tmp/claude-settings-<sha256-prefix-of-json>.json with mode 0644. Because /tmp is shared across all macOS user
accounts on the same machine — and because identical --settings values hash to the same path — the second user to
launch Claude.app on a shared Mac gets EACCES and the CLI exits with code 1 in under a second.
Environment
- macOS (any recent version — /tmp shared, $TMPDIR per-user)
- Claude.app desktop 1.7196.0
- Bundled Claude Code CLI 2.1.138
- Two macOS user accounts on the same Mac, both using Claude.app
Repro
- macOS Mac with two user accounts, e.g. userA and userB
- userA logs in, launches Claude.app, sends a message → works. The desktop app spawns the bundled CLI with --settings
'{}' (among other args), and the CLI creates /tmp/claude-settings-44136fa355b3678a.json (mode 0644, owner userA)
- userB logs in (or switches to their account), launches Claude.app, sends a message
- Desktop app spawns the same bundled CLI with the same --settings '{}'. The CLI tries to open the existing
/tmp/claude-settings-44136fa355b3678a.json for write, gets EACCES, and exits 1
Expected
The CLI should write its per-invocation settings cache to a path that doesn't collide across user accounts (or should
fall back gracefully on EACCES).
Actual
stderr:
Error processing settings: EACCES: permission denied, open '/tmp/claude-settings-44136fa355b3678a.json'
Process exits with code 1, before producing any stream-json output. The desktop app surfaces this as the generic
banner:
▎ Claude Code crashed
▎ Try sending your message again. If it keeps happening, share feedback so we can investigate.
▎ Claude Code process exited with code 1
The user has no in-app indication of the actual cause — every new session, every retry, every reinstall fails
identically.
Suggested fix
Use $TMPDIR (which is per-user on macOS, e.g. /var/folders/<hash>/.../T/) instead of /tmp. Node's os.tmpdir() already
returns the right per-user path on macOS. Something like:
path.join(os.tmpdir(), claude-settings-${hash}.json)
If /tmp is intentional for cross-process sharing within one user, consider including the UID in the filename (e.g.
claude-settings-${uid}-${hash}.json) or scoping under /tmp/claude-${uid}/.
Workaround
Until fixed, the affected user has to delete the offending file each time the other user has launched the app more
recently:
sudo rm /tmp/claude-settings-<hash>.json
sudo chmod 666 on the file works as a longer-term workaround if the CLI does in-place rewrites rather than
unlink-and-recreate.
Impact
Affects any shared-Mac setup with multiple macOS user accounts (work + personal on the same machine, family computers,
lab machines, etc.).
What Should Happen?
claude code in app should be working
Error Messages/Logs
Claude Code crashed
Try sending your message again. If it keeps happening, share feedback so we can investigate.
Claude Code process exited with code 1
Steps to Reproduce
just use claude code from the mac's app
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.141 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗