Cursor CLI Agent のインストールと使い方:ログインと最初のリポジトリ作業

公式 install、agent login、リポジトリで一つのレビュー可能な diff。Cursor アカウントが必要。

The first hour with Cursor Agent in the terminal usually breaks on PATH, skipping agent login, or never landing a reviewable diff. Install the official agent binary, sign in, then change one small thing in a repo you own.

The query is how to install and use Cursor CLI Agent. This page follows Cursor docs at cursor.com/docs/cli/installation, cursor.com/docs/cli/overview, and cursor.com/docs/cli/reference/authentication. It is Cursor’s terminal agent, not this site’s meeting product. To walk a diff on a short call, open a room on wbmeet; see how to create and join a room.

Install agentSign inOne repo task

What Cursor CLI does

Cursor CLI lets you work with an AI agent in the terminal: read files, propose edits, and run commands (with sandbox controls). Run agent interactively, or use non-interactive flags such as agent -p "…" in scripts. Default mode is Agent; /plan or Shift+Tab switches to Plan, and /ask is read-only. Usage and models follow your Cursor account plan—see official pricing.

agent
CLI binary
login
Browser auth
API Key
CI automation

Install Cursor CLI

  1. 1

    Run the official installer

    macOS, Linux, WSL: curl https://cursor.com/install -fsS | bash. Native Windows PowerShell: irm 'https://cursor.com/install?win32=true' | iex. Add ~/.local/bin to PATH per the installation page (bash/zsh profile + source).

  2. 2

    Verify

    New terminal: agent --version. command not found means PATH is missing $HOME/.local/bin—this is the standalone CLI, not only the IDE integrated terminal.

  3. 3

    Optional manual update

    The CLI tries to auto-update. Run agent update when you want to pull the latest build explicitly.

Authenticate: browser or API key

  1. 1

    Browser login (recommended)

    agent login opens your browser to sign in with your Cursor account. Set NO_OPEN_BROWSER=1 to print the URL for headless machines. agent status should show you as authenticated.

  2. 2

    API key (scripts/CI)

    Create a user API key in Cursor Dashboard → API Keys. Export CURSOR_API_KEY or pass --api-key once. Never commit live keys.

  3. 3

    Switch or sign out

    agent logout clears stored credentials. Billing and model access follow your subscription—official Cursor docs are the source of truth.

First task in your repo

  1. 1

    cd to the repo root

    Work in a Git repo you own. Run git status before the agent edits files.

  2. 2

    Start a session

    Run agent, or agent "explain the entry module in one paragraph". On large trees, start with /ask or read-only questions.

  3. 3

    Land a reviewable change

    Follow up with a concrete ask: add a unit test for one untested helper or input validation on one public function—show the diff first. Read git diff line by line. Use agent resume to continue context.

# First hour · Cursor CLI · 2026-09
curl https://cursor.com/install -fsS | bash
agent --version
cd /path/to/your/project
agent login
agent
# task: one unit test; show diff first

Modes and pitfalls

ScenarioMode / commandFirst-hour note
Daily codingDefault AgentRead tool output before approving
Design first/plan, Shift+TabLarge refactors start in Plan
Read-only/ask, --mode=askNo file writes
CI reviewagent -p "…"Use CURSOR_API_KEY
Sandbox/sandboxControl network per policy
01

agent: command not found

Add ~/.local/bin to PATH and open a new terminal.

02

Not authenticated

Run agent login or set CURSOR_API_KEY. Headless: NO_OPEN_BROWSER=1.

03

First task too large

Split tasks; use Ask first; insist on diff-first.

Official path: curl install → agent --version → agent login → agent in your repo → review diff. Trust cursor.com/docs/cli for details.

Vs Claude Code / Copilot CLI
Different install and auth. See our Claude Code and Copilot CLI notes.
Cursor IDE required?
The CLI runs standalone; IDE and CLI share account login but are separate entry points.
Not a meeting-product guide
Only Cursor CLI’s first hour. Short call: wbmeet.

Questions worth checking

Can I use the CLI without a Cursor account?

agent login requires a Cursor account; API keys are created in the Dashboard. Plans and usage limits follow Cursor’s terms.

What if the browser does not open?

Set NO_OPEN_BROWSER=1 and open the printed URL manually.

How do I run agent in CI?

Set CURSOR_API_KEY and use non-interactive agent -p prompts. Do not commit keys.

Must the first task touch production code?

No. Start read-only, then one reversible test or validation.

無料で会議を開始