Gemini CLI setup
Set up Gemini CLI approvals on your phone with native hooks. Gate shell commands, file edits and MCP calls, and see what changes under gemini --yolo.
Pushary puts Gemini CLI's risky tool calls on your phone. Native Gemini hooks (small programs Gemini runs around each tool call) check your Pushary policy before each shell command, file write, edit and MCP call, and the ones that need a person wait for your answer. Gemini CLI has no --dangerously-skip-permissions. Its --yolo flag approves everything, and a deny from your phone still blocks the call.
On 18 June 2026 Google stopped serving Gemini CLI to Google AI Pro, Ultra and free accounts and moved them to Antigravity CLI. Gemini Code Assist Standard and Enterprise licences keep Gemini CLI. This guide covers Gemini CLI. For Antigravity CLI, see the Antigravity CLI guide.
Set it up
npx pushary@latest setupOn Windows PowerShell, run npx.cmd pushary@latest setup. The CLI needs Node.js 20.17+, 22.13+ or 23.5+.
Scan the QR code with your phone
Setup shows a QR code first. Scan it with your phone's camera or the Pushary app. Sign in or create an account, check that the code on your phone matches the one in your terminal, then tap Approve on Connect this computer? and allow notifications.
New accounts start a 3-day free trial, then pay $9.99 a month. A card is needed to start the trial. If this computer already has a Pushary key, setup reuses it and skips this step.
Pick Gemini CLI
Setup asks Which agents do you use? with the agents it found already selected. Keep Gemini CLI selected. To skip the question, run npx pushary@latest setup --agents gemini_cli. If the gemini command is not installed, setup skips it.
Answer the test question
Setup sends a test push, then a test question. Answer it on your phone. The terminal says You're set once your answer arrives.
Restart Gemini CLI
Gemini loads hooks when it starts. Gemini does not make you trust a hook first, so approvals work as soon as you restart.
On a Mac you can use Pushary Isle instead. It connects Gemini CLI for you and needs no Node.
What setup changes on your computer
| File | What changes |
|---|---|
~/.gemini/settings.json | Adds the pushary MCP server (httpUrl, your key in an Authorization header, and trust: true so Pushary's own tools run without a prompt). Adds six hook events. |
~/.gemini/GEMINI.md | Adds a Pushary block that tells Gemini to ask through Pushary instead of the terminal. |
~/.pushary/config.json and your shell profile | Your API key, as PUSHARY_API_KEY. |
Setup also installs the pushary package globally, so each hook starts fast.
What each hook does
| Event | What happens |
|---|---|
BeforeTool | The approval gate. Runs before run_shell_command, write_file, replace and MCP tools. The kill switch and always-deny rules block here. Other calls follow your approval mode. Waits up to 180 seconds. |
AfterTool | Records tool_complete or tool_error and clears pending phone questions. |
BeforeAgent | Saves your prompt as the session's task title. Set PUSHARY_TASK_TITLES=off to turn it off. |
AfterAgent | Marks the turn finished. |
SessionStart | Shows the session in your session list from its first second. |
SessionEnd | Marks the session idle and cancels pending phone questions. |
Check that it works
npx pushary@latest doctorDoctor checks your key and plan, then Gemini's MCP server, hooks and GEMINI.md block. It sends a real test push. Add --roundtrip to send a test question too.
Then try a real approval. A new workspace starts on Always, so it reaches your phone while you sit at your computer. If yours is on When away, decisions are left to Gemini's own prompt while you are there. To test from your desk, open the Pushary app, tap Questions & approvals at the top of your inbox, and pick Always.
Ask Gemini: Create a file called pushary-test.txt that says hello. Your phone buzzes with the write request. Tap Approve and the file appears. Switch back to When away when you are done.
What Pushary can and cannot enforce on Gemini CLI
Gemini's tools have different names from Claude Code's, so Pushary maps them onto your existing rules:
| Gemini tool | Pushary rule |
|---|---|
run_shell_command | Bash |
write_file | Write |
replace | Edit |
| MCP tools | mcp__<server>__<tool> |
One rule works across every agent. A rule you set for Bash also gates run_shell_command. File reads and other Gemini tools are not gated.
Gemini's hook protocol has no "ask" answer. When Pushary leaves a call to Gemini, it prints nothing and Gemini's own confirmation runs. That happens:
- in In agent and Alert only modes,
- in When away, when you are at your computer, when nobody answers your phone in time, or when Pushary cannot be reached,
- in Always, when no phone is connected, when Pushary hands the call back to your keyboard, or when nobody answers and your rule says Ask in terminal.
In Always, a question Pushary could not send at all is refused.
Gemini CLI --yolo and dangerously skip permissions
Gemini CLI has no --dangerously-skip-permissions flag. The equivalent is gemini --yolo (short form -y, or --approval-mode yolo), which approves every tool call with no prompt. Ctrl+Y toggles it inside a session. Use it only in a throwaway or sandboxed environment.
Pushary does not make yolo safe. Every call Pushary leaves to Gemini runs with no prompt under yolo. That includes a question nobody answered when the rule says Ask in terminal, a call handed back to your keyboard, a call made while your plan has lapsed, and a call where the hook itself failed.
To answer fewer prompts in the terminal and still approve risky calls on your phone, stay in Gemini's default or auto_edit mode and set your Pushary approval mode to Always. Gated calls go to your phone. Anything Pushary hands back falls to Gemini's own approval mode, so a shell command still gets a prompt instead of running unchecked. Under auto_edit, an edit Pushary hands back runs without a prompt, so use default if every hand-back should prompt.
See Gemini dangerously skip permissions for the approval modes and Antigravity CLI's flag.
Set it up by hand
Use setup if you can. It pins each hook command to its full path.
Install the Pushary CLI globally, unless which pushary-gemini-hook already prints a path. An existing install under @pushary/agent-hooks provides the same commands, and npm refuses to install over them.
npm install -g pusharyAdd the MCP server to ~/.gemini/settings.json. Replace the token with your API key:
{
"mcpServers": {
"pushary": {
"httpUrl": "https://pushary.com/api/mcp/mcp",
"headers": { "Authorization": "Bearer pk_xxx.xxx" },
"trust": true
}
}
}Add the hooks under the same top-level object. Replace /path/to/pushary-gemini-hook with the output of which pushary-gemini-hook, and use the same path in every entry. Gemini counts hook timeouts in milliseconds.
{
"hooks": {
"BeforeTool": [
{
"matcher": "run_shell_command|write_file|replace|mcp_.*",
"hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 180000 }]
}
],
"AfterTool": [
{
"matcher": "run_shell_command|write_file|replace|mcp_.*",
"hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 10000 }]
}
],
"BeforeAgent": [
{ "hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 10000 }] }
],
"AfterAgent": [
{ "hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 10000 }] }
],
"SessionStart": [
{ "hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 10000 }] }
],
"SessionEnd": [
{ "hooks": [{ "name": "pushary", "type": "command", "command": "/path/to/pushary-gemini-hook", "timeout": 10000 }] }
]
}
}Save your key in your shell profile so the hook can read it:
export PUSHARY_API_KEY="pk_xxx.xxx"Restart Gemini CLI, then run npx pushary@latest doctor.
Troubleshooting
Gemini still asks in the terminal
That is expected when Pushary leaves the call to Gemini, for example at your desk in When away mode. See the list under What Pushary can and cannot enforce on Gemini CLI.
The hooks never run
- Restart Gemini CLI. It reads
~/.gemini/settings.jsonat start. - Check that
~/.gemini/settings.jsonhas ahooks.BeforeToolentry that runspushary-gemini-hook. - Run
npx pushary@latest doctor. It lists any hook event that is missing.
Gemini CLI stopped working with my Google account
Google moved Google AI Pro, Ultra and free accounts to Antigravity CLI. Set up Antigravity CLI instead.
Setup says Pushary for Mac handles Gemini CLI's approvals
The Mac app already owns Gemini's hooks. Setup reuses the app's key and keeps the app's hooks. To have the CLI own them instead, run npx pushary@latest setup --take-over-hooks.
Next steps
Set your approval rules
Choose which actions run on their own and which wait for you.
Gemini CLI notifications
Get Gemini CLI's finished tasks and approvals on your phone.
Antigravity CLI setup
Phone approvals for agy, the CLI that replaced Gemini CLI for most accounts.