[BUG] Desktop preview_start fails for projects in ~/Documents on macOS: getcwd "Operation not permitted" despite Documents access (see #42914)
What's Wrong?
In the Claude desktop app (Code tab), preview_start with a .claude/launch.json configuration fails immediately when the project lives in ~/Documents, which is a TCC-protected folder on macOS. The launched process can't even resolve its own working directory, so it dies before the runtime executable starts.
The Claude app has been granted access to the Documents folder (System Settings → Privacy & Security → Files and Folders). In the same session and the same directory, commands run through the agent's Bash tool work normally: reading and writing project files, running a 385-test pytest suite, and starting this same server with nohup. Only the preview launcher is denied.
What Should Happen?
The preview dev server should start in the project directory, with the same folder access the Bash tool already has in that session.
Error Messages/Logs
The dev server exited during startup (code 1).
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Operation not permitted
pyenv: cannot change working directory to `'
Steps to Reproduce
- Put a project under
~/Documents(here~/Documents/CRM, a Flask app). - Grant Claude access to the Documents folder in Privacy & Security → Files and Folders.
- Add
.claude/launch.json:
``json``
{
"version": "0.0.1",
"configurations": [
{ "name": "crm", "runtimeExecutable": "python", "runtimeArgs": ["app.py"], "port": 5001 }
]
}
- Ask Claude to start the preview (
preview_startwithname: "crm"). - It fails with the error above. Retrying gives the identical error.
- In the same session, the Bash tool starts the same app from the same directory without problems.
Possibly relevant: the two launch paths get different TCC attribution
Process tree of the shell used by the Bash tool:
/Applications/Claude.app/Contents/MacOS/Claude
└─ /Applications/Claude.app/Contents/Helpers/disclaimer
└─ ~/Library/Application Support/Claude/claude-code/2.1.260/claude.app/Contents/MacOS/claude
└─ /bin/zsh
The disclaimer helper makes Claude.app the responsible process, so the Bash tool inherits the Documents grant. The preview launcher doesn't seem to go through that path, so macOS evaluates it without the grant: getcwd returns EPERM (not ENOENT), before the configured executable runs.
Claude Model
Claude Opus 5
Is this a regression?
I don't know
Claude Code Version
2.1.260 (bundled with Claude desktop 1.49585.0)
Platform
Anthropic API (Claude desktop app, Code tab)
Operating System
macOS 26.6.2 (Darwin 25.6.0)
Terminal/Shell
Claude desktop app, Code tab (login shell: zsh)
Additional Information
Earlier reports of the same symptom were closed by the stale bot, not fixed, and the bot asked for a new issue if still relevant: #42914, #75614, #51312. It is still reproducible.
Workaround: start the server from the Bash tool instead of the preview.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗