Cursor CLI: how to install it, use the agent command, and what it costs
Dmitriy Solodukha · Updated · 6 min read
Checked against Caprock v0.190.1
Cursor CLI: install it on macOS, Linux or Windows, run agent or cursor-agent, script it with -p, and how its usage counts. What Caprock shows of it.
Cursor CLI is Cursor's coding agent in the terminal. Install it with curl https://cursor.com/install -fsS | bash on macOS, Linux or WSL, or irm 'https://cursor.com/install?win32=true' | iex in Windows PowerShell, then run agent in a project. The older name, cursor-agent, still works. On Cursor's current plans it draws on the same weekly usage pool as the editor.
Caprock keeps the record of every coding agent you run. Free and open source. Install Caprock ↓
How to install Cursor CLI
On macOS, Linux and WSL, from Cursor's installation docs, read on 23 November 2026:
$ curl https://cursor.com/install -fsS | bash $ agent --version
On Windows, natively, in PowerShell:
$ irm 'https://cursor.com/install?win32=true' | iex
On macOS, Linux and WSL the script puts the CLI under ~/.local/share/cursor-agent/versions/ and links it into ~/.local/bin; on Windows it installs to %LOCALAPPDATA%\cursor-agent and adds that folder to your PATH. If a Mac or Linux shell does not find agent afterwards, add ~/.local/bin to your PATH, for zsh:
$ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc $ source ~/.zshrc
The CLI tries to update itself by default; agent update updates it by hand.
agent or cursor-agent?
Both run the same program. The install script, read on 23 November 2026, creates two links in ~/.local/bin to one executable: "primary: agent, legacy: cursor-agent". Cursor's docs now use agent everywhere; older tutorials, such as Codecademy's "Getting Started with Cursor CLI", still say cursor-agent.
agent is a generic name, and other tools use it. Before it links, the script runs rm -f ~/.local/bin/agent ~/.local/bin/cursor-agent, so a different tool's agent in that folder is replaced. On my machine ~/.local/bin/agent is Grok's CLI, a link into ~/.grok/bin, which also installs itself as agent. Check which one you have with ls -l ~/.local/bin/agent. cursor-agent always means Cursor, so scripts that must not guess should call it.
Sign in
- On your machine:
agent loginopens the browser; setNO_OPEN_BROWSER=1to get the URL printed instead.agent statussays who is signed in,agent logoutclears it. - In scripts and CI: create an API key in the Cursor dashboard and set
CURSOR_API_KEY, or pass--api-key.
Cursor CLI commands
agent, oragent "refactor the auth module"to start with a prompt. You review the changes it proposes and approve its commands.- Plan and ask modes. "The CLI supports the same modes as the editor."
--plan(or Shift+Tab, or/plan) designs an approach first;--mode askor/askis read-only. - Models.
agent modelsor--list-modelslists what your account can use;--model <id>or/modelpicks one. - Back to a chat.
agent lslists previous chats,agent resumereopens the latest,--resume <chat id>a given one. - A worktree of its own.
-wor--worktree [name]runs the chat in a new Git worktree under~/.cursor/worktrees/<repo>/<name>. - Hand off to the cloud. A message starting with
&pushes the conversation to a Cloud Agent "to continue running while you're away".
Non-interactive mode and GitHub Actions
-p (--print) runs one prompt and prints the answer, for scripts and CI. Without --force it still edits files in the workspace but rejects actions that need approval; --force (alias --yolo) allows commands unless they are explicitly denied. --output-format is text (the default), json or stream-json.
$ agent -p "What does this codebase do?" $ agent -p "review these changes for security issues" --output-format text
In GitHub Actions, Cursor's docs install the CLI with the same script, add its folder to GITHUB_PATH, put the key in a secret named CURSOR_API_KEY, and run agent -p "…" as a step. They recommend limiting what the agent may do through the CLI's permissions settings for production workflows, rather than giving it full control of git and external calls.
How Cursor CLI usage counts
The CLI has no price of its own. Cursor's pricing docs, read on 23 November 2026, put it in one weekly pool with the editor on the current plans (legacy Pro, Pro+ and Ultra keep their monthly pools): the pool is shared across "Agent in the editor, CLI, Cloud Agents, Grok Bot, and the Grok apps".
- Cursor's own models (Grok 4.7, 4.6 and 4.5, Composer 2.5) draw on the pool, which every paid plan includes and which refreshes weekly.
- Claude, GPT and Gemini are not in the pool. On Premium and above they bill at the model's API list price from prepaid credit; Plus runs Cursor's models only.
- Where to see it: remaining usage and the reset date are in the editor's settings and under Usage at
grok.com/dashboard. The CLI's slash commands have no usage or cost command.
Every plan and price, and what happens when the pool runs out: Cursor pricing.
Cursor CLI vs Claude Code
Both are terminal agents with an interactive mode, a print mode for scripts (agent -p, claude -p) and GitHub Actions. The difference is mostly whose models and whose plan:
- Cursor CLI runs Cursor's models from the weekly pool, and other vendors' models at API price on Premium and above. Use it if you already pay for Cursor and want the editor's agent in a terminal or in CI.
- Claude Code is Anthropic's, runs Claude models, and comes with Claude Pro and Max. Use it if Claude is the model you want and you would rather pay one plan for it.
Price by price, and what Claude costs inside Cursor: Cursor vs Claude Code.
Cursor CLI in Caprock, and what it cannot show
Caprock, a free desktop app for macOS, Windows and Linux, runs Cursor's CLI beside Claude Code, Codex and the other agents it starts:
- Start it. New agent → Cursor opens
cursor-agentin a Caprock terminal tab, in the folder you pick, with the model you type; Bypass adds--force. Sign in once withcursor-agent loginin a terminal of your own: Caprock never handles your Cursor sign-in. - Continue it. An ended CLI chat continues with
cursor-agent --resume <chat id>. - The right binary. Caprock starts
cursor-agent, and takesagentonly when it resolves into Cursor's own install folder, so another tool'sagentis never started by mistake. - Chats you start yourself appear once you press Turn on Cursor hooks on the Cost screen. That adds Caprock to
~/.cursor/hooks.jsonbeside other tools' entries; the hooks only observe, and Remove Cursor hooks takes out only Caprock's. Then each chat's prompts, replies, tool calls and edited files are on the same screens as your other agents'.
What it cannot show, honestly: a Cursor CLI chat has no tokens and no cost in Caprock. Cursor's hooks carry neither, and Caprock does not read the messages in the CLI's own chat store, so where a cost would be it reads "—", with a note that Cursor records no cost for the chat, rather than $0.00. Chats in Cursor's editor are different: Caprock reads the cost Cursor itself recorded per chat and model, but Cursor writes one for some chats and not others, and a chat without one shows its tokens and no price. Caprock does not guess Cursor's bill from list prices. For what the CLI used, the usage page at grok.com/dashboard is the source.
What Caprock adds for a Cursor user is the rest: Cursor's chats next to Claude Code and Codex, searchable, on one machine, with Cursor's own cost where it kept one. Install Caprock to see them together.
Questions people ask
- How do I install Cursor CLI?
- On macOS, Linux or WSL run curl https://cursor.com/install -fsS | bash; on Windows, in PowerShell, irm 'https://cursor.com/install?win32=true' | iex. Then check it with agent --version; on macOS or Linux, add ~/.local/bin to your PATH if the shell does not find it.
- What is the difference between agent and cursor-agent?
- None: the macOS and Linux installer links both names to the same executable, agent as the primary and cursor-agent as the legacy name. Other tools also install a command called agent, so cursor-agent is the unambiguous one.
- Is Cursor CLI free?
- It has no separate price. It uses your Cursor plan: on current plans Cursor's own models draw on the same weekly pool as the editor, and Claude, GPT and Gemini bill at API list price from prepaid credit on Premium and above.
- How do I use Cursor CLI in GitHub Actions?
- Install it in a step with the same install script, add its folder to GITHUB_PATH, store an API key from the Cursor dashboard in a secret named CURSOR_API_KEY, and run agent -p with your prompt.
Sources
- Cursor docs — CLI overview (interactive and print mode, plan and ask, sessions, cloud handoff), read 23 November 2026
- Cursor docs — CLI installation (macOS, Linux, WSL, Windows; ~/.local/bin; agent update), read 23 November 2026
- Cursor install script (agent the primary link, cursor-agent the legacy one), read 23 November 2026
- Cursor docs — CLI authentication (agent login, status, CURSOR_API_KEY), read 23 November 2026
- Cursor docs — CLI parameters (--model, --force, --output-format, --worktree, models, ls, resume), read 23 November 2026
- Cursor docs — CLI slash commands (/model, /plan, /ask, /resume), read 23 November 2026
- Cursor docs — headless CLI (print mode, --force, output formats), read 23 November 2026
- Cursor docs — CLI in GitHub Actions, read 23 November 2026
- Cursor docs — pricing (the weekly pool shared by the editor and the CLI, where usage is shown), read 23 November 2026
- Cursor CLI, read 23 November 2026
- Claude Code docs — run Claude Code programmatically (claude -p)
- Caprock — Cursor support (docs/cursor.md)
- Caprock — Cursor design notes: CLI chats through hooks, no tokens or cost (.ai/25-cursor.md)
- Caprock source — internal/agents/binaries.go (cursor-agent, and agent only when it is Cursor's)
- Caprock changelog — Cursor support (0.177.0); a cursor-agent chat's cost reads — (0.190.1)
Try it
The record of every coding agent you run, the sessions it did not start included. Free, open source; nothing leaves your machine.
Caprock is a desktop app: it installs on your computer, not your phone.
Or email yourself the link:
macOS, Windows and Linux. Your phone pairs with it by QR code. Install options →
Notarized by Apple. One file for Apple silicon and Intel, macOS 13 or later.
Windows 10 22H2 or later, x64. Windows may ask once whether to run it: click More info, then Run anyway.
Paste it into Claude Code, Codex or any coding agent.
See what it says ▾
Install the Caprock desktop app for me. It is open source (Apache-2.0), a local app for my coding agents: https://github.com/dspv/caprock What the install does and how to remove it: https://github.com/dspv/caprock/blob/master/docs/install-agent.md Run the install script for my system: https://caprock.dev/mac.sh, /win.ps1 or /linux.sh. Read it before you run it if you like. Leave my Claude Code settings alone; the app asks me itself. Tell me when it's open.
Or run it yourself:
Paste in Terminal: it installs Caprock and opens it.Or with Homebrew: brew install --cask dspv/tap/caprock-app
Or run it yourself:
Paste in PowerShell: it installs Caprock for you and opens it.
Or run it yourself:
Paste in a terminal: it installs Caprock for you, no sudo. Or download the AppImage