# Cursor CLI: how to install it, use the agent command, and what it costs

*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.*

Dmitriy Solodukha, checked 2026-11-23 · https://caprock.dev/guides/cursor-cli/

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.

**In short**
- **Install:** the one-line script above; on macOS and Linux it links `agent` and `cursor-agent` into `~/.local/bin`.
- **Run:** `agent` for a chat, `agent -p "…"` for scripts and CI, `agent resume` to go back to the last chat.
- **Cost:** no separate price; on current plans the CLI shares the editor's weekly pool, and the usage is at grok.com/dashboard.
- **Caprock** starts and continues `cursor-agent` beside Claude Code and Codex, but Cursor's CLI records no tokens or cost for Caprock to show.

## 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 login` opens the browser; set
  `NO_OPEN_BROWSER=1` to get the URL printed instead. `agent status` says
  who is signed in, `agent logout` clears 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`**, or `agent "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
  ask` or `/ask` is read-only.
- **Models.** `agent models` or `--list-models` lists what your account
  can use; `--model <id>` or `/model` picks one.
- **Back to a chat.** `agent ls` lists previous chats, `agent resume`
  reopens the latest, `--resume <chat id>` a given one.
- **A worktree of its own.** `-w` or `--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](https://caprock.dev/guides/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](https://caprock.dev/guides/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-agent` in a Caprock
  terminal tab, in the folder you pick, with the model you type; *Bypass*
  adds `--force`. Sign in once with `cursor-agent login` in 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 takes `agent`
  only when it resolves into Cursor's own install folder, so another tool's
  `agent` is 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.json` beside
  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](https://caprock.dev/install/) to see them together.

## Sources

- [Cursor docs — CLI overview (interactive and print mode, plan and ask, sessions, cloud handoff), read 23 November 2026](https://cursor.com/docs/cli/overview)
- [Cursor docs — CLI installation (macOS, Linux, WSL, Windows; ~/.local/bin; agent update), read 23 November 2026](https://cursor.com/docs/cli/installation)
- [Cursor install script (agent the primary link, cursor-agent the legacy one), read 23 November 2026](https://cursor.com/install)
- [Cursor docs — CLI authentication (agent login, status, CURSOR_API_KEY), read 23 November 2026](https://cursor.com/docs/cli/reference/authentication)
- [Cursor docs — CLI parameters (--model, --force, --output-format, --worktree, models, ls, resume), read 23 November 2026](https://cursor.com/docs/cli/reference/parameters)
- [Cursor docs — CLI slash commands (/model, /plan, /ask, /resume), read 23 November 2026](https://cursor.com/docs/cli/reference/slash-commands)
- [Cursor docs — headless CLI (print mode, --force, output formats), read 23 November 2026](https://cursor.com/docs/cli/headless)
- [Cursor docs — CLI in GitHub Actions, read 23 November 2026](https://cursor.com/docs/cli/github-actions)
- [Cursor docs — pricing (the weekly pool shared by the editor and the CLI, where usage is shown), read 23 November 2026](https://cursor.com/docs/account/pricing)
- [Cursor CLI, read 23 November 2026](https://cursor.com/cli)
- [Claude Code docs — run Claude Code programmatically (claude -p)](https://code.claude.com/docs/en/headless)
- [Caprock — Cursor support (docs/cursor.md)](https://github.com/dspv/caprock/blob/master/docs/cursor.md)
- [Caprock — Cursor design notes: CLI chats through hooks, no tokens or cost (.ai/25-cursor.md)](https://github.com/dspv/caprock/blob/master/.ai/25-cursor.md)
- [Caprock source — internal/agents/binaries.go (cursor-agent, and agent only when it is Cursor's)](https://github.com/dspv/caprock/blob/master/internal/agents/binaries.go)
- [Caprock changelog — Cursor support (0.177.0); a cursor-agent chat's cost reads — (0.190.1)](https://github.com/dspv/caprock/blob/master/CHANGELOG.md)
