GuidesHosting choices

Cursor CLI: install, sign in over SSH, plans and headless use

Cursor CLI (the agent command) as of November 2026: install on macOS, Linux or a server, sign in over SSH or with an API key, plans, agent -p, config.

November 28, 2026The Everpod team
The short answer

Cursor CLI is Cursor’s coding agent in the terminal, the same agent as in the Cursor editor, with Agent, Plan and Ask modes and a print mode for scripts. Its command is agent (cursor-agent is the older name, still installed beside it). Install it on macOS, Linux or WSL with curl https://cursor.com/install -fsS | bash and add ~/.local/bin to your PATH. On a server over SSH, run NO_OPEN_BROWSER=1 agent login and open the printed URL on your own laptop or phone, or skip the browser with an API key in CURSOR_API_KEY. It draws on your Cursor plan (as of November 2026, Free, Plus $8, Premium $30, Super $100, Ultra $200 a month), from the same weekly pool as the editor.

What Cursor CLI is

Cursor’s CLI overview says it lets you “interact with AI agents directly from your terminal”. You type agent in a project folder, ask for a change, and approve or reject each terminal command it wants to run. It has three modes, switched with Shift+Tab: Agent (the default, with every tool), Plan (designs the approach and asks questions before writing code) and Ask (reads, never changes anything). Previous chats come back with agent ls, agent resume or agent --continue, and starting a message with & hands the task to one of Cursor’s Cloud Agents, which you can pick up at cursor.com/agents.

It needs no Cursor editor on the machine. That is what makes it the Cursor you can run on a server: the editor is a desktop app, while the CLI is a single download into your home directory. If you are weighing Cursor the editor against Claude Code, that comparison is Claude Code vs Cursor.

Install it on macOS, Linux or a server

The installation page gives one line for macOS, Linux and WSL, and one for Windows PowerShell:

curl https://cursor.com/install -fsS | bash             # macOS, Linux, WSL
irm 'https://cursor.com/install?win32=true' | iex        # Windows PowerShell
Copied

Piping a script into a shell runs whatever it says, so here is what the macOS and Linux script did as published on November 28, 2026 (build 2026.11.22). It works out your system (Linux or macOS, x64 or arm64; anything else stops with an error), downloads a tarball from downloads.cursor.com and unpacks it into ~/.local/share/cursor-agent/versions/. It then deletes any existing ~/.local/bin/agent and ~/.local/bin/cursor-agent and links both names to the new build. It never uses sudo, leaves your shell config alone (it prints the PATH line for you to add), and does not verify a checksum or signature on the download. To read it before running it:

curl -fsS https://cursor.com/install -o cursor-install.sh
less cursor-install.sh
bash cursor-install.sh
Copied

Then put ~/.local/bin on your PATH, as the docs give it for bash (use ~/.zshrc for zsh), and check the version:

echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
agent --version
Copied

One catch in that delete-then-link step: another tool that also installs a command called agent into ~/.local/bin loses it to Cursor, or takes it back if installed afterwards. Cursor’s forum has the case of xAI’s Grok CLI, where agent login opened Grok’s sign-in instead of Cursor’s, because whichever installer ran last owned the agent link. The fix given in the thread is to run Cursor as cursor-agent, the separate link its installer makes, since a later Grok update can take agent back again. In scripts, cursor-agent is the safer name.

The CLI updates itself by default; agent update does it on demand. To remove it, run agent logout first so the stored login goes too, then delete ~/.local/share/cursor-agent and the two links in ~/.local/bin (this cannot be undone; your config in ~/.cursor stays unless you delete that too).

Sign in without a browser on the machine

agent login opens your default browser to sign in to your Cursor account. A server reached over SSH has no browser to open, so the authentication page says to run it like this and open the printed URL yourself, on your laptop or phone:

NO_OPEN_BROWSER=1 agent login
agent status     # confirms who you are signed in as
Copied

Since July 2026, pressing q during the login shows the same URL as a QR code, which the changelog says lets you “scan it from a phone to finish authentication over SSH without copying a long link.” Narrow terminals still show the URL only.

Where the login is kept: on macOS, the keychain. On Linux, since version 2026.11.19, the system keyring (GNOME Keyring or KWallet), and, in the changelog’s words, “If no keyring is available or it is locked, the CLI keeps using the owner-only file.” A plain server usually has no keyring, so expect the file. agent logout clears it.

With an API key instead. For scripts, CI and any machine where you would rather not sign in interactively, create a user API key in the Cursor dashboard under API Keys and give it to the CLI in CURSOR_API_KEY, which Cursor recommends over the --api-key flag. Both forms in the docs put the key on a command line, where it lands in your shell history (and, with the flag, in the process list while it runs). To keep it in a file only you can read and load it per run:

read -rsp 'Cursor API key: ' k; echo
(umask 077; printf '%s\n' "$k" > ~/.cursor-api-key); unset k

CURSOR_API_KEY="$(cat ~/.cursor-api-key)" agent status
Copied

The key acts as your account, so treat it like a password and revoke it in the dashboard if it leaks.

Which Cursor plan it needs, and how usage is counted

Since October 12, 2026, Cursor is sold as part of The X Subscription, which Cursor’s pricing help calls “one subscription for Grok, Cursor, and X.” Prices from cursor.com/pricing on November 28, 2026, in US dollars a month:

PlanPriceWhat the agent gets
Free
$0Limited agent and chat requests
Plus
$8A shared pool; “Only Grok models are available on this plan”
Premium
$304x Plus’s usage; Cloud Agents; third-party models at API list price
Super
$10015x Plus’s usage
Ultra
$20050x Plus’s usage

The CLI has no allowance of its own. Cursor’s models and pricing page says “Each paid plan includes one pool of usage for Cursor models”, drawn on by the agent in the editor, the CLI, Cloud Agents and the Grok apps alike, and that “It refreshes weekly”, so a heavy week of Grok chat leaves less for coding. Cursor’s own models come out of that pool. Claude, GPT and other third-party models do not: on Premium and up they are billed at the model’s API list price from prepaid credit, and Plus and Free do not offer them. When the pool runs out you wait for the weekly reset, spend prepaid credit, or move up a plan. Inside the CLI, /usage shows your meters and agent models lists what your account can use; new installs start on Auto, Cursor’s model routing.

If you subscribed before October 12 (Pro at $20, Pro+ at $60, Ultra), your plan carries on unchanged unless you switch, with monthly rather than weekly pools. Cursor’s pages do not say whether the CLI works on the Free plan.

Headless: agent -p for scripts

-p (or --print) runs one prompt and exits, which is what a cron job, a CI step or a shell script wants. Output is plain text by default, or JSON with --output-format json or one JSON event per line with stream-json:

agent -p "What does this codebase do?"
agent -p --output-format json "Summarise the open TODOs" | jq -r '.result'
agent -p --force "Fix the failing tests"     # also runs commands that would need approval
Copied

Know what a print run may do before you schedule one. The headless page is plain about it: “Print mode writes to files in your workspace even without --force”, and runs whatever needs no approval; anything that would need approval is rejected unless you add --force (alias --yolo), which allows every command not explicitly denied. If your CLI config sets approvalMode to unrestricted, print mode runs everything without --force too. Run it in a repository you can reset, on a machine whose credentials you would not mind it reaching. --trust skips the workspace trust prompt in headless runs, and --workspace points it at a folder. An unattended run needs a login that is already stored or CURSOR_API_KEY. Cron does not read your ~/.bashrc, so give it the full path:

# crontab -e: every day at 07:00
0 7 * * * cd ~/myrepo && CURSOR_API_KEY="$(cat ~/.cursor-api-key)" ~/.local/bin/cursor-agent -p --trust "Summarise yesterday's commits" >> ~/agent-report.log 2>&1
Copied

For an interactive session that survives your SSH connection dropping, run agent inside tmux.

Where its config, rules and MCP servers live

PathWhat it holds
~/.cursor/cli-config.json
Your CLI settings and permissions (on Linux and BSD with XDG_CONFIG_HOME set, under $XDG_CONFIG_HOME/cursor/; CURSOR_CONFIG_DIR moves it)
.cursor/cli.json
A project’s permissions; nothing else can be set per project
.cursor/rules/*.mdc
Project rules, the same system as the editor; a plain .md there is ignored
AGENTS.md, CLAUDE.md
Read at the project root and applied as rules
~/.cursor/mcp.json
MCP servers for every project, shared with the editor
.cursor/mcp.json
A project’s MCP servers

Permissions are lists of exact strings under permissions.allow and permissions.deny, with the types Shell(git), Read(src/**), Write(docs/**), WebFetch(domain) and Mcp(server:tool). An MCP server added in the editor works in the CLI too, since both read the same mcp.json (an mcpServers object, each entry with command, args and env for a local server, or url and headers for a remote one). agent mcp list shows their status, and agent mcp login <name> signs in to one that uses OAuth; from an SSH session it prints the port-forwarding steps that sign-in needs. A repository that already has an AGENTS.md or a CLAUDE.md for another agent is read as it is.

Cursor CLI beside Claude Code and Codex

All three are terminal agents that run on the same kind of machine, with a one-shot mode for scripts. Where they differ for unattended use, from each maker’s docs as of November 28, 2026:

Cursor CLIClaude CodeCodex CLI
One-shot command
agent -pclaude -pcodex exec
What a script run may do by default
Edits files and runs what needs no approval; the rest is rejectedCalls that need approval are denied (Manual mode, v2.1.302 and later)Read-only by the docs; a trusted project’s default can be workspace-write, so pass --sandbox explicitly (codex exec)
Key for scripts
CURSOR_API_KEYANTHROPIC_API_KEY, or a stored loginCODEX_API_KEY, or a stored login
Plan it bills
Cursor (The X Subscription)ClaudeChatGPT, or the OpenAI API
Models
Cursor’s own in the pool; others at API price from PremiumClaudeOpenAI’s

The practical difference is the model and the plan you already pay for: Cursor CLI makes sense when you have a Cursor plan and want its agent off your laptop, and Claude in it costs API rates on top. Cursor set against OpenAI’s agent as a whole, editor included, is Codex vs Cursor. The Claude Code alternatives guide sets it beside the other terminal agents, and choosing a VPS for a coding agent covers the server any of them runs on.

Run Claude Code, Codex, OpenCode, Pi, Hermes or OpenClaw on an always-on developer pod.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.