> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axuremart.com/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI 命令行

> 在终端中安装、配置和使用 Claude Code

## 第一步：安装

1. 打开 VSCode（Trae、Cursor 也可以）
2. 点击顶部菜单「终端」→「新建终端」，终端会在编辑器底部打开
3. 输入以下命令

```bash theme={null}
npm install -g @anthropic-ai/claude-code
```

![安装 Claude](https://mintcdn.com/agent-pm/oHetu81dZtjYE4sA/images/img-01.png?fit=max\&auto=format\&n=oHetu81dZtjYE4sA\&q=85\&s=9c1b9dd94762cfef733c4bb6442b605f)

苹果电脑如果遇到权限错误（提示 `errno: -13`），在命令前加 `sudo`：

```bash theme={null}
sudo npm install -g @anthropic-ai/claude-code
```

## 第二步：配置 API Key

用 cc switch 填 API Key 和请求地址，步骤见 [cc switch 配置](https://docs.axuremart.com/cc-switch.md) 的「Claude Code」标签页。

## 第三步：开始使用

在终端输入：

```bash theme={null}
claude --dangerously-skip-permissions
```

![首次启动](https://mintcdn.com/agent-pm/oHetu81dZtjYE4sA/images/img-12.png?fit=max\&auto=format\&n=oHetu81dZtjYE4sA\&q=85\&s=0952274d95c77b1be0f61b13d8668e4a)

启动后默认使用 Claude opus 5.5。要换成 Claude sonnet 5.5 或开启 1M 上下文，在输入框里输入 `/model` 切换。

![切换模型](https://mintcdn.com/agent-pm/oHetu81dZtjYE4sA/images/img-07.png?fit=max\&auto=format\&n=oHetu81dZtjYE4sA\&q=85\&s=ad1f03a24442a80200a604d889fe4191)

电脑意外关机后，用下面的命令启动，可以恢复上一次的对话记录和上下文：

```bash theme={null}
claude --continue --dangerously-skip-permissions
```

## 更新

| 操作 | 命令 |
| - | - |
| 查看当前版本 | `claude --version` |
| 更新到最新版 | `claude install` |
| 通过 npm 更新到最新版 | `npm update -g @anthropic-ai/claude-code` |
| 安装指定版本 | `npm install -g @anthropic-ai/claude-code@版本号` |

想在编辑器里用可视化界面，看 [VSCode 插件](https://docs.axuremart.com/claude-code/vscode.md)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.