--dangerously-skip-permissions: what it does and how to keep your Mac safe
--dangerously-skip-permissions is the same as starting Claude Code with --permission-mode bypassPermissions. It removes the approval prompt, and checks on protected paths are skipped too; only a few actions that no mode auto-approves still apply. Anthropic's docs reserve this mode for isolated environments such as containers, VMs and dev containers without internet access. On your main Mac, a wrong command runs with the rights of your user account. If you only want fewer prompts, use allow rules or auto mode instead.
01What the flag turns off
Claude Code has a start mode that decides how much it asks. Which one you get depends on the version: since v2.1.283 interactive terminal and VS Code sessions start in auto mode. Manual mode, whose config value is default, asks before Bash commands except a built-in set of read-only ones. Each prompt is a moment where you see the command before it runs.
The flag skips that moment. What replaces the prompt is "Nothing. Protected path checks are also skipped; the actions no mode auto-approves still apply". Protected paths include the .git and .claude folders, so writes there go through without a question. An approved command can write anywhere your user account can, so with no approval step that is the working rule for everything Claude runs.
The flag only works if you pass it at launch: you cannot switch into this mode from a session that started without it. The first interactive start shows a warning dialog that asks you to accept responsibility. The CLI also refuses the flag when it runs as root, the all-powerful system account.
Two things still hold with the flag on:
- Deny rules. A deny rule is a line in your settings that forbids a tool or command. It blocks in every mode, including bypassPermissions. Allow rules have no effect there, because nothing is left to allow.
- PreToolUse hooks. A hook is your own script that Claude Code runs at a set moment. One that returns a deny decision stops the tool even with the flag on. Examples are on the Claude Code hooks page.
Instructions in your prompt or CLAUDE.md are not on this list. Permission rules are enforced by Claude Code itself, not by the model.
02What can go wrong on your main Mac
Public cases show the pattern.
| What happened | Where | What it shows |
|---|---|---|
| Claude Code ran a recursive delete that removed all user files in a home directory; the reporter saw it run and interrupted it too late | GitHub issue #10077, October 2025 | One command is enough to do the damage |
| A Cursor user running YOLO mode reported the agent ended up "deleting everything on my computer, including itself" | Cursor forum | The same failure in another tool with prompts off |
The s1ngularity malware prompted AI command-line tools already installed on the machine with --dangerously-skip-permissions, --yolo and --trust-all-tools | Wiz research | Attackers know the flag names |
The s1ngularity case shows how. It was a supply-chain attack, meaning a poisoned package that arrives through a tool you trust. Its payload ran on Linux and macOS and searched for wallets, keystores, .env files and SSH keys. It did not need to break anything: it asked your own agent to look for files, using the flags that skip the approval step. It succeeded in hundreds of cases, although the AI providers' guardrails at times interceded.
A malicious repository once had a way to switch bypass mode on for you. An advisory, CVE-2026-33068 (a public number for a security hole), describes a repo whose committed .claude/settings.json set permissions.defaultMode to bypassPermissions and silently skipped the trust dialog. That was an older version. The current docs say that bypassPermissions set in project .claude/settings.json or settings.local.json does not take effect and the session starts in Manual mode. Keep Claude Code updated anyway. The full advisory list is on the Claude Code security page.
03When --dangerously-skip-permissions is reasonable
The docs give one answer: isolated containers, VMs and dev containers without internet access. A dev container is a Docker container your editor opens your project in. Claude's commands execute inside it rather than on your Mac, while edits to project files appear in your local repository. Anthropic says the flag is acceptable there because the container runs Claude Code as a non-root user and confines command execution to the container.
A good setup has three properties:
- No secrets inside. Do not mount
~/.sshor cloud credential files into the container. Use repository-scoped or short-lived tokens. - A limit on outgoing traffic. The docs say to pair the flag with network egress restrictions, meaning rules about which servers the container may contact, to limit what a bypassed session can reach. The reference container ships an
init-firewall.shscript that allows outbound traffic only to listed destinations. - Trusted code. Use dev containers only with repositories you trust, and monitor what Claude does.
A container is not a safe room. Claude can still modify any file in the mounted project folder, and those changes appear on your Mac. The container also does not prevent a malicious project from exfiltrating, which means sending out, anything reachable inside it, including the Claude Code credentials in ~/.claude. Commit before you start, so Git can bring files back.
Setup steps are not repeated here. They live in Claude Code devcontainer, and Docker specifics are in Claude Code in Docker.
04The flag, auto mode and the sandbox side by side
You may not need the flag at all. This table is the one place on the site that sets the options next to each other.
| Option | What reviews each action | Where it fits |
|---|---|---|
| Manual mode | You | Reviewing every action yourself, sensitive work |
| Auto mode | A separate classifier, a second model that judges each proposed action | Reduces prompts but does not guarantee safety |
| Sandbox | The operating system; on macOS the built-in Seatbelt framework, a macOS feature that limits what a process can touch | Shell commands only; file tools, MCP servers and hooks run outside it |
| bypassPermissions (the flag) | Nothing | Isolated containers and VMs only |
Auto mode even blocks launching an agent loop started with this flag. What else it blocks and allows is listed once, on the Claude Code auto mode page. The sandbox is off by default. When it is on, Claude can retry a failed command outside it through an escape hatch called dangerouslyDisableSandbox. More: Claude Code sandbox and Claude Code permissions.
05The same flag in Codex
Codex has its own version: --dangerously-bypass-approvals-and-sandbox, with the alias --yolo. OpenAI's docs say to avoid it unless you are inside a dedicated sandbox VM. If Codex keeps asking and you only want fewer prompts, its workspace-write mode lets the agent edit inside the project and run routine local commands there. See Codex full auto.
06If something already went wrong
Stop the session first. Then work out what changed and what could have leaked.
- Files Claude edited. Run
/rewind(or/undo) to open the rewind menu. A file changed only by Bash commands is not tracked, so use Git for it. - Files in Git. Run
git statusandgit diffto see the damage.git restorebrings paths in the working tree back from a restore source. - Files outside Git. On APFS disks, Time Machine keeps hourly local snapshots for up to 24 hours, even if your backup disk is not attached.
- Keys. Check which
.envfiles and tokens the session could read. Rotate any key you cannot rule out, from a trusted system.
07Should you use the flag on your own Mac
No. Use --dangerously-skip-permissions inside a container or VM that holds no secrets and has a limit on outgoing traffic. Do not use it on the Mac where your SSH keys, cloud credentials and browser sessions live. If the goal is fewer clicks, allow rules, auto mode and the sandbox cut prompts, each with the limits listed above. Section overview: AI agent permissions. The slang around the flag is explained in Claude Code YOLO mode.
Whatever mode you choose, it helps to know what actually ran on the Mac. Artificial Immunity's free, open-source core watches Claude Code, Cursor, Codex, MCP servers and every program start, and reports what it finds without blocking anything.
FAQ
Is Claude Code dangerous with this flag?
It can be. With the flag on, Claude Code runs commands without asking, and an approved command can write anywhere your user account can. A container with no secrets limits the damage to the project folder and whatever is reachable inside it.
Why does Claude Code keep asking for permission?
In manual mode (config value default) it asks before Bash commands, except a built-in set of read-only ones. Allow rules cut the prompts without turning everything off.
What is the difference between auto mode and dangerously skip permissions?
Auto mode puts a separate classifier model in front of actions and blocks launching an agent loop started with this flag. The flag takes the prompt away and puts nothing in its place.
Do deny rules still work with the flag?
Yes. Deny rules block in every mode, including bypassPermissions, while allow rules have no effect there.
How do I enable it in the Claude desktop app?
The desktop app reads the same settings files as the CLI and applies the permission mode to new local sessions. You cannot switch into bypass mode from a session that started without it.
Is there a way to bypass Codex approvals?
Yes. Codex has --dangerously-bypass-approvals-and-sandbox, alias --yolo, and OpenAI's docs say to avoid it outside a dedicated sandbox VM.
Can a company stop developers from using the flag?
Yes. Admins can set permissions.disableBypassPermissionsMode to disable in managed settings.
Related guides
Sources
- Claude Code docs: permission modes
- Claude Code docs: permissions
- Claude Code docs: sandboxing
- Claude Code docs: development containers
- Claude Code docs: hooks guide
- Claude Code docs: checkpointing
- Claude Code issue #10077
- Wiz: s1ngularity supply-chain attack
- OpenAI Codex docs: approvals and security
- Git: git-restore
- Artificial Immunity