How to Install Cursor CLI and Run Your First AI Coding Task

October 10, 2026

Cursor CLI is a terminal-based AI coding agent from Anysphere that reads your repo, edits files, and runs shell commands from a single prompt. You install it with one curl command, log in with your Cursor account, then run cursor inside any project folder. A first task usually takes under 10 minutes.

I have been using the desktop editor for months, but the command line version is a different animal. It is faster, it fits into scripts, and it works over SSH on machines where you never open a GUI. This guide covers the install, the login flow, and one real task so you actually see it work.

What Is Cursor CLI and Who Is It For?

It is the same agent that powers the Cursor editor, packaged as a standalone binary. The agent keeps a local index of your project, proposes diffs, and asks before touching anything outside the directory you started in.

It suits backend developers and DevOps folks who live in a shell. It is a poor fit if you just want autocomplete while typing in an IDE — the desktop app handles that better. The CLI wants a defined task, not a conversation.

How Do You Install Cursor CLI?

One command on macOS, Linux, or WSL:

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

On Windows, run it inside WSL2 rather than native PowerShell — the file watching behaves better. After install, reload your shell and confirm:

cursor --version

You should see a version string (the current line is 1.x). If the command is not found, add ~/.local/bin to your PATH.

How Do You Authenticate?

Run cursor login. It prints a URL and a short code. Open the URL in any browser, paste the code, and authorize. The CLI stores a token locally, so you only do this once per machine.

The agent uses your existing Cursor subscription quota. Free accounts get a limited number of premium requests per month; heavy agent runs burn through that fast, so check your plan before pointing it at a 200-file repository.

How Do You Run Your First Task?

Open a terminal inside a project and start the agent:

cd ~/projects/my-api
cursor

Then type a concrete instruction instead of a vague one. Compare these:

  • Vague: “clean up my code” — you will get random suggestions.
  • Specific: “add a /health endpoint to app.py that returns JSON with the git commit hash” — the agent reads files, writes the code, and shows a diff.

Review the proposed diff. Press to accept, or tell it what to change. When it wants to run a shell command it asks first, which is the safety net most people care about.

What Are the Main Gotchas?

Large monorepos get slow to index on first run. Point it at a subfolder instead of the whole tree. Also, the agent sometimes picks up context from the wrong file in a big repo — naming the exact file in your prompt fixes that most of the time.

Key Takeaways

  • Cursor CLI installs with one curl command and runs from any project folder.
  • It reuses your Cursor subscription quota; free tiers cap premium requests.
  • Specific prompts with file names beat vague ones every time.
  • It runs on macOS, Linux, and WSL2 — avoid native Windows PowerShell.
  • The agent asks before running shell commands, which limits surprise damage.