Skip to content

Commit e299533

Browse files
docs(cursor-cli): 澧炲姞 WSL 瀹夎璇存槑涓?ripgrep 鏁呴殰鎺掗櫎
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 843b5f0 commit e299533

File tree

1 file changed

+77
-10
lines changed

1 file changed

+77
-10
lines changed

tutorials/cursor/cursor-cli.md

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
## 📋 目录
66

77
1. [简介](#简介)
8-
2. [安装](#安装)
9-
3. [验证安装](#验证安装)
10-
4. [交互式模式](#交互式模式)
11-
5. [非交互式模式(脚本/无头)](#非交互式模式脚本无头)
12-
6. [工作模式](#工作模式)
13-
7. [会话管理](#会话管理)
14-
8. [Cloud Agent 交接](#cloud-agent-交接)
15-
9. [常用场景示例](#常用场景示例)
16-
10. [故障排除](#故障排除)
8+
2. [依赖要求](#依赖要求)
9+
3. [安装](#安装)
10+
4. [验证安装](#验证安装)
11+
5. [交互式模式](#交互式模式)
12+
6. [非交互式模式(脚本/无头)](#非交互式模式脚本无头)
13+
7. [工作模式](#工作模式)
14+
8. [会话管理](#会话管理)
15+
9. [Cloud Agent 交接](#cloud-agent-交接)
16+
10. [常用场景示例](#常用场景示例)
17+
11. [故障排除](#故障排除)
1718

1819
---
1920

@@ -30,6 +31,46 @@
3031
3132
---
3233

34+
## 依赖要求
35+
36+
Cursor CLI 依赖 **ripgrep (rg)** 进行代码库搜索。未安装时会出现:
37+
38+
```text
39+
Could not find ripgrep (rg) binary. Please install ripgrep. Error: rg is not installed
40+
```
41+
42+
导致 `agent``agent ls``agent -p "..."` 等命令无法正常使用(仅 `agent about``agent --version` 等不依赖搜索的命令可用)。
43+
44+
### 安装 ripgrep
45+
46+
**Windows(推荐用 winget):**
47+
48+
```powershell
49+
winget install --id BurntSushi.ripgrep.GNU --accept-package-agreements --accept-source-agreements
50+
```
51+
52+
若未安装 winget,可使用 [Chocolatey](https://chocolatey.org/)`choco install ripgrep`,或从 [GitHub Releases](https://github.com/BurntSushi/ripgrep/releases) 下载并解压到 PATH。
53+
54+
**macOS:**
55+
56+
```bash
57+
brew install ripgrep
58+
```
59+
60+
**Linux / WSL:**
61+
62+
```bash
63+
# Ubuntu/Debian
64+
sudo apt install ripgrep
65+
66+
# 或从项目根目录
67+
curl -LO https://github.com/BurntSushi/ripgrep/releases/latest/download/ripgrep_*.deb && sudo dpkg -i ripgrep_*.deb
68+
```
69+
70+
安装完成后**新开一个终端**,执行 `rg --version` 确认可用,再使用 `agent`
71+
72+
---
73+
3374
## 安装
3475

3576
### Windows(PowerShell)
@@ -42,14 +83,34 @@ irm 'https://cursor.com/install?win32=true' | iex
4283

4384
安装完成后,**重新打开终端**(或新开一个 PowerShell 窗口),再使用 `agent` 命令。
4485

45-
### macOS / Linux / WSL
86+
### macOS / Linux
4687

4788
```bash
4889
curl https://cursor.com/install -fsS | bash
4990
```
5091

5192
安装后若找不到 `agent`,可重启终端或执行 `source ~/.bashrc` / `source ~/.zshrc`
5293

94+
### WSL(Windows 子系统 for Linux)
95+
96+
**可以**在 WSL 中使用 Cursor CLI,且推荐在 WSL 内安装 Linux 版,避免 Windows 下 PATH、ripgrep 等依赖问题。
97+
98+
1. **在 WSL 终端**(如 Ubuntu)中安装 CLI:
99+
100+
```bash
101+
curl https://cursor.com/install -fsS | bash
102+
```
103+
104+
2. **在 WSL 内安装 ripgrep**(一条命令即可,无需 winget):
105+
106+
```bash
107+
sudo apt update && sudo apt install -y ripgrep
108+
```
109+
110+
3. 新开一个 WSL 终端,执行 `agent --version``rg --version` 确认可用,然后即可使用 `agent``agent -p "..."` 等。
111+
112+
说明:WSL 中运行的是 Linux 环境,使用与 Linux 相同的安装方式;认证会使用 Cursor 账户(首次可能需在已登录 Cursor 的 Windows 端完成一次关联,或按提示登录)。
113+
53114
---
54115

55116
## 验证安装
@@ -235,6 +296,12 @@ agent -p "审查当前 git 改动,关注安全和可读性"
235296

236297
## 故障排除
237298

299+
### 报错:Could not find ripgrep (rg) binary
300+
301+
说明系统未安装 **ripgrep**,Cursor CLI 的搜索与对话功能依赖它。请按上文 [依赖要求](#依赖要求) 安装 ripgrep,然后**重新打开终端**再运行 `agent`。验证:`rg --version` 能输出版本号即可。
302+
303+
**Windows 上 winget 安装 ripgrep 失败时**(如提示“文件被占用”等):可改用 **WSL**,在 WSL 内执行 `sudo apt install ripgrep` 并安装 Cursor CLI(见上文 [WSL](#wslwindows-子系统-for-linux)),一般更稳定。
304+
238305
### 找不到 `agent` 命令
239306

240307
- **Windows**:安装后请**新开一个 PowerShell 窗口**,或检查 PATH 是否包含 Cursor CLI 所在目录

0 commit comments

Comments
 (0)