← All posts

Guide

How to install and use the Cursor CLI (cursor-agent) on macOS, Windows & Linux

How to install and use the Cursor CLI (cursor-agent) on macOS, Windows & Linux

Most people meet Cursor as an editor — a VS Code fork with an AI agent baked into the sidebar. But Cursor also ships a separate command-line agent that runs entirely in your terminal, no editor window required. It's the same kind of tool as Claude Code or Codex: you point it at a repo, describe a task, and it reads files, writes edits, and runs commands. People call it cursor-agent, and it's handy when you live in the terminal, want to drive an agent over SSH, or wire one into a script.

Getting it running takes a couple of minutes. The friction is usually one thing: Cursor installs the CLI through its own script rather than npm, and that exact command shifts between releases, so it's worth pulling from the source. Here's the whole path on macOS and Windows, plus how it differs from running Claude Code once it's up.

Run script curl | bash Log in agent login Open a repo cd project Give it a task agent
Four steps: run the install script, sign in to Cursor, drop into a repo, then it's just one command.

What cursor-agent actually is

cursor-agent is Cursor's coding agent unbundled from the editor and shipped as a standalone binary. It runs the same agent loop you get inside the Cursor app — model access, file edits, command execution, your project rules — but in a plain terminal session. A few things to know up front:

Install the Cursor CLI on macOS or Linux (curl)

Cursor distributes the CLI with an install script rather than a package manager. The current flow is a one-line curl piped into your shell:

curl https://cursor.com/install -fsS | bash

That drops the binary into ~/.local/bin. If your shell can't find agent afterward, that directory isn't on your PATH — add ~/.local/bin to your PATH in ~/.zshrc (or your shell's rc file on Linux) and reopen the terminal. Then confirm it landed:

agent --version

Piping a script straight into bash is convenient but worth a glance first — if you'd rather inspect it, fetch the URL in a browser before running it. Because Cursor changes this command between releases, grab the current one from the official CLI install docs rather than trusting a tutorial that might be stale.

Install cursor-agent on Windows (PowerShell)

On Windows the same idea runs through PowerShell instead of curl. The current command fetches the installer and pipes it into iex:

irm 'https://cursor.com/install?win32=true' | iex

Run that in PowerShell or Windows Terminal, then check it with agent --version. If you work primarily inside WSL, treat that distro like macOS and use the curl ... | bash command from inside the Linux shell instead — pick whichever environment your repos actually live in so paths line up. As with macOS, confirm the exact command against Cursor's docs before pasting, since the query string and host can change.

Sign in to your Cursor account

The CLI doesn't work anonymously — it needs a Cursor account. After installing, log in:

agent login

That opens your browser, you authenticate with Cursor, and the credentials get stored locally so you only do it once. You can check the result anytime with agent status, which shows whether you're authenticated and which account you're on. If you're automating in CI where no browser exists, Cursor also supports an API key via the CURSOR_API_KEY environment variable instead of the interactive login — the authentication docs cover that path.

Keep it updated

The CLI ships its own updater and auto-updates by default, so day to day you don't have to think about versions. Two commands cover the rest:

agent --version   # what you're on now
agent update      # force the latest release

If an update ever leaves the binary in a bad state, the fix is the same command you installed with — re-run the install script for your platform and it replaces the binary in place, keeping your login and config.

Your first run in a repo

Change into a project you don't mind it editing, then start the interactive session:

cd my-project
agent

Describe a task in plain English — "add input validation to the signup form and a test for it." The agent reads the relevant files, proposes changes, and before it runs any terminal command it stops to ask you to approve (y) or reject (n). You can also pass a prompt straight in as an argument, or run a one-shot non-interactive job with the print flag, which is what makes it easy to script:

agent -p "summarize what this service does" --output-format text

Like any agent, start in a git repo with a clean working tree so you can git diff exactly what it changed and roll back if you don't like it. In print mode the agent only proposes edits by default — it needs an explicit flag (--force) before it will actually write files, which is a sensible guardrail for the first few runs. If you've thought about vibe coding, this is the loop you'll be working in.

How it differs from Claude Code

If you've already installed Claude Code, cursor-agent will feel familiar — same describe-edit-run rhythm — but a few things diverge:

Neither is strictly better — it usually comes down to which account you already pay for and which models you prefer. The deeper trade-offs are their own topic in Claude Code vs Cursor. The good news: both speak the same terminal, so nothing stops you from running them side by side and even running multiple agents at once on different tasks.

Frequently asked questions

How do I install cursor-agent on Windows?

Open PowerShell (or Windows Terminal) and run: irm 'https://cursor.com/install?win32=true' | iex — that fetches Cursor's installer and runs it. Verify with agent --version, then sign in with agent login. If you work inside WSL, use the macOS/Linux curl command from your Linux shell instead.

Is cursor-agent free?

The CLI itself is a free download, but it signs in with your Cursor account, so agent and model usage draws on your Cursor plan. Cursor's free tier includes limited usage; sustained agent work needs a paid plan. Check Cursor's pricing page for current limits.

What is the difference between the Cursor CLI and the Cursor editor?

They are separate installs of the same underlying agent. The Cursor editor is a VS Code-style app with the agent in a sidebar; the Cursor CLI (cursor-agent) runs that agent in a plain terminal as the agent command — no editor window, scriptable, usable over SSH. Both share one Cursor account, plan, and rules.

How do I update the Cursor CLI?

The CLI auto-updates by default, so most of the time you already have the latest version. To force it, run agent update; if the binary is ever broken, re-run the install script from Cursor's docs — it replaces the binary in place. Check what you're on with agent --version.

Where Backgrind fits

Once cursor-agent is doing real work, a single task can run for minutes and then stop to ask for approval or finish while you've tabbed away — and the terminal ends up buried. Backgrind wraps the same agent CLI you just installed, with your login and config, in an always-on-top overlay that floats over whatever you're doing and flashes only when it needs a decision or completes — so you can stop watching the terminal. There's a live demo if you want to see it in motion.