Gemini CLI YOLO mode: the approval modes and how to sandbox it
Gemini CLI YOLO mode is an approval mode in which every tool is auto-approved. The old --yolo and -y flags are deprecated, and the CLI reference says to use --approval-mode=yolo instead. Turn on the sandbox before you use it. On macOS the sandbox uses Seatbelt, and its default profile confines writes to the project folder but still allows broad reads and network access.
01The old flag and the new one
The --yolo flag is marked "Deprecated" in the CLI reference, with the instruction to use --approval-mode=yolo. The new flag takes a mode name, so Gemini CLI YOLO mode is now one value among four. Run it like this:
gemini --approval-mode=yolo02The four approval modes
The --approval-mode flag controls how tool calls are approved. Its choices are default, auto_edit, yolo and plan. The policy engine docs spell the second one autoEdit, so you may see either spelling.
| Mode | What the agent can do without asking |
|---|---|
| default | The standard interactive mode where most write tools require confirmation |
| auto_edit | Optimized for automated code editing; some write tools may be auto-approved |
| plan | A strict, read-only mode for research and design |
| yolo | All tools are auto-approved (use with extreme caution) |
With no flag, the mode is default. In default mode, write tools such as write_file and run_shell_command default to ask_user, which means they ask you first. That is the prompt you skip in yolo.
03What yolo mode turns off
The policy engine is the part of Gemini CLI that decides whether a tool call is allowed, asked about or denied. In yolo mode, a high-priority rule allows all tools. Shell commands are tools too, so nothing asks you before one runs.
An approval you grant while in yolo mode applies only to yolo. Switching back to default does not carry those approvals along.
The policy engine can also deny a shell command by its prefix, for example rm -rf. That is a useful guard against honest mistakes. Because yolo adds a rule that allows all tools, rely on the sandbox below for anything you cannot afford to lose.
04What it looks like when it goes wrong
In July 2025, Ars Technica described a Gemini CLI session where the destruction happened through a series of move commands targeting a directory that never existed. The tool then said, "I have failed you completely and catastrophically". The user's own analysis named the cause: the absence of a read-after-write verification step. In plain words, the agent never checked that the folder it was moving files into really existed. Yolo mode takes away the prompt where you might have noticed.
Outside attackers know about the flag too. A supply-chain attack, where malicious code arrives inside a package you installed, has prompted installed AI command line tools with --yolo to steal files. The story is told once, on the dangerously-skip-permissions page.
05Put a sandbox around it on a Mac
A sandbox is a fence around what commands can touch. Sandboxing isolates potentially dangerous operations, such as shell commands or file modifications, from your host system. It is the right partner for yolo mode.
You can turn it on three ways, in this order of precedence: the -s or --sandbox flag, the GEMINI_SANDBOX environment variable, or settings.json. The flag looks like this:
gemini --sandbox --approval-mode=yoloPick the sandbox type to match your Mac:
- Seatbelt, the macOS built-in. Seatbelt is a macOS tool for restricting what a program may touch, and Gemini CLI uses it through
sandbox-exec. The default profile, permissive-open, denies operations by default and confines writes to the project directory, while allowing broad file reads and network access. Reads stay broad, so files outside the project can still be read, and the network stays open. For a tighter fence, choose a profile withSEATBELT_PROFILE;strict-proxiedrestricts reads and writes and sends network traffic through a proxy. - Docker or Podman. Both are tools that run programs in an isolated container, and one of them must be installed and running. The default image is
ghcr.io/google/gemini-cli:latest. Inside, your working directory is mounted at the exact same absolute path as on your host, so the agent can still change your project files. Commit first.
The two options compare like this:
| Sandbox | What it limits | What it leaves open |
|---|---|---|
| Seatbelt, default profile | Writes, confined to the project directory | Broad file reads and network access |
Seatbelt, strict-proxied | Reads and writes; network goes through a proxy | Whatever the proxy lets through |
| Docker or Podman | Runs in a container with the default image | Your project files, mounted at the same path |
Gemini's own description of the sandbox flag is short: run in a sandboxed environment for safer execution. The aim is to limit file system access to the project directory and to put a security barrier between AI operations and your environment. Read that as a lower risk, not as zero. An agent in yolo mode inside the default Seatbelt profile can still read files outside the project and reach the network.
06Which approval mode fits which job
Match the mode to the risk instead of jumping straight to yolo:
- Exploring an unfamiliar codebase. Use
plan. The agent reads and proposes, and cannot write. - Everyday edits in a repo you trust. Use
auto_edit, where some write tools may be auto-approved. - Anything that runs shell commands. Stay on
default, whererun_shell_commandasks first. - A long unattended run. This is the only case for yolo. Do it in a container or a throwaway VM with no keys in reach, as Cursor staff suggested for its own YOLO mode.
07Folders you have not read yet
Trusted Folders is a Gemini CLI feature that decides whether a project may load its own settings. It is disabled by default, and you must first enable it in your settings. In an untrusted folder, the CLI will not load the .gemini/settings.json file from the project. Yolo mode plus a repository you did not write is the riskiest pair, so switch Trusted Folders on before you open one.
08A safer routine for Gemini CLI YOLO mode
- Try
auto_editfirst. - Use
planwhen you only want the agent to read and propose. - Commit before a yolo session, so Git can bring files back.
- Start yolo only with the sandbox on, and prefer a container if you cannot spare your keys.
- Keep secrets out of the project folder and the environment.
The same ideas apply to other agents. Claude Code has bypass mode and a YOLO page of its own. Cursor's no-prompt mode is covered in Cursor YOLO mode, and Codex has its own flag in Codex full auto. For the sandbox idea across tools, see AI agent sandbox, and for the wider picture, AI agent permissions.
09Should you use Gemini CLI YOLO mode?
Only inside a container or a throwaway VM. On your main Mac, stay on default or auto_edit, add the sandbox and keep Git history. Yolo saves clicks, and the price is that nothing reviews what the agent does next.
With yolo on, it helps to know what actually ran on the Mac. Artificial Immunity's free, open-source core watches every program start and the places where code starts on its own, and reports what it finds without blocking anything.
FAQ
What is YOLO mode in Gemini CLI?
It is an approval mode where all tools are auto-approved, and the docs say to use it with extreme caution. You start it with --approval-mode=yolo.
Is the --yolo flag still supported?
It is deprecated. The CLI reference says to use --approval-mode=yolo instead.
Can Claude Code run in YOLO mode?
Yes, under another name: the bypassPermissions mode, which --dangerously-skip-permissions is equivalent to. The docs say to use it only in isolated environments such as containers, VMs or dev containers without internet access. Actions that no mode auto-approves still apply.
How do I configure the Gemini CLI?
Install it with npm install -g @google/gemini-cli. Pick the approval mode with --approval-mode, whose choices are default, auto_edit, yolo and plan. Enable the sandbox with the -s or --sandbox flag, the GEMINI_SANDBOX environment variable or settings.json.
Does a policy rule still protect me in yolo mode?
In yolo mode, a high-priority rule allows all tools. The policy engine can deny a shell command by its start, such as rm -rf, but treat the sandbox as the guard that holds, not a deny rule.
Is Gemini CLI still free for individuals?
The README says free individual access and Google AI Pro and Ultra plans moved to Antigravity CLI on June 18, 2026. Check which tool you are running.