Claude Code on desktop 
桌面上的Claude Code 

Run Claude Code tasks locally or on secure cloud infrastructure with the Claude desktop app
使用 Claude 桌面app在本地或安全的云基础设施上运行 Claude Code 任务

The Claude desktop app provides a native interface for running multiple Claude Code sessions on your local machine and seamless integration with Claude Code on the web.
Claude 桌面app为本地计算机上运行多个 Claude Code 会话提供了原生界面,并与 Claude Code on the web 无缝集成。

一,Installation  安装

macOS:https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs

Windows:https://claude.ai/api/desktop/win32/x64/exe/latest/redirect?utm_source=claude_code&utm_medium=docs

Windows ARM64:https://claude.ai/api/desktop/win32/arm64/exe/latest/redirect?utm_source=claude_code&utm_medium=docs (Windows ARM64 上不可用本地会话)

二,Features  功能
Claude Code on desktop provides:
桌面版的 Claude Code 提供:

Parallel local sessions with git worktrees: Run multiple Claude Code sessions simultaneously in the same repository, each with its own isolated git worktree
使用 git 工作树进行并行本地会话:在同一仓库中同时运行多个 Claude Code 会话,每个会话拥有自己的隔离 git 工作树

Include files listed in your .gitignore in your worktrees: Automatically copy files in your .gitignore, like .env, to new worktrees using .worktreeinclude
将 .gitignore 中列出的文件包含到工作树中:使用 .worktreeinclude 自动将 .gitignore 中的文件,如 .env ,复制到新的工作树中

Launch Claude Code on the web: Kick off secure cloud sessions directly from the desktop app
从桌面应用启动 Claude Code on the web:直接从桌面应用启动安全的云会话

三,Using Git worktrees  使用 Git 工作树
Claude Code on desktop enables running multiple Claude Code sessions in the same repository using Git worktrees. Each session gets its own isolated worktree, allowing Claude to work on different tasks without conflicts. The default location for worktrees is ~/.claude-worktrees but this can be configured in your settings on the Claude desktop app.
Claude Code 桌面版支持在同一个仓库中使用 Git 工作树运行多个 Claude Code 会话。每个会话都会获得自己的隔离工作树,允许 Claude 在不同任务之间无冲突地工作。工作树的默认位置是 ~/.claude-worktrees ,但你可以在 Claude 桌面应用中的设置中配置它。

If you start a local session in a folder that does not have Git initialized, the desktop app will not create a new worktree.
如果你在一个没有初始化 Git 的文件夹中启动本地会话,桌面应用将不会创建新的工作树。

3.1 Copying files ignored with .gitignore
复制被 .gitignore 忽略的文件

When Claude Code creates a worktree, files ignored via .gitignore aren’t automatically available. Including a .worktreeinclude file solves this by specifying which ignored files should be copied to new worktrees.
当 Claude Code 创建工作树时,通过 .gitignore 忽略的文件不会自动可用。包含一个 .worktreeinclude 文件通过指定哪些被忽略的文件应该被复制到新的工作树中解决了这个问题。

Create a .worktreeinclude file in your repository root:
在你的仓库根目录中创建一个 .worktreeinclude 文件:

.env
.env.local
.env.*
**/.claude/settings.local.json

The file uses .gitignore-style patterns. When a worktree is created, files matching these patterns that are also in your .gitignore will be copied from your main repository to the worktree.
该文件使用 .gitignore 样式的模式。当创建工作树时,匹配这些模式并且也存在于你的 .gitignore 中的文件会被从主仓库复制到工作树中。

Only files that are both matched by .worktreeinclude AND listed in .gitignore are copied. This prevents accidentally duplicating tracked files.
只有同时被 .worktreeinclude 匹配且列在 .gitignore 中的文件才会被复制。这可以防止意外地复制已跟踪的文件。

3.2 Launch Claude Code on the web
启动云端Claude Code

From the desktop app, you can kick off Claude Code sessions that run on Anthropic’s secure cloud infrastructure.
从桌面应用程序,你可以启动在 Anthropic 安全云基础设施上运行的 Claude Code 会话。

To start a web session from desktop, select a remote environment when creating a new session.
要从桌面开始网页会话,在创建新会话时选择远程环境。


四,Bundled Claude Code version
捆绑的 Claude Code 版本
也就是内置的版本

Claude Code on desktop includes a bundled, stable version of Claude Code to ensure a consistent experience for all desktop users. The bundled version is required and downloaded on first launch even if a version of Claude Code exists on the computer. Desktop automatically manages version updates and cleans up old versions.
桌面版的 Claude Code 包含一个捆绑的稳定版本,以确保所有桌面用户获得一致的使用体验。捆绑版本是必需的,并在首次启动时下载,即使计算机上已存在 Claude Code 的某个版本也是如此。桌面版会自动管理版本更新并清理旧版本。

The bundled Claude Code version in Desktop may differ from the latest CLI version. Desktop prioritizes stability while the CLI may have newer features.
桌面版捆绑的 Claude Code 版本可能与最新的 CLI 版本不同。桌面版优先考虑稳定性,而 CLI 可能有更新的功能。

五,Environment configuration
环境配置

For local environments, Claude Code on desktop automatically extracts your $PATH environment variable from your shell configuration. This allows local sessions to access development tools like yarn, npm, node, and other commands available in your terminal without additional setup.
对于本地环境,桌面版的 Claude Code 会自动从您的 shell 配置中提取 $PATH 环境变量。这允许本地会话访问 yarn 、 npm 、 node 等开发工具以及其他终端中可用的命令,无需额外设置。

5.1 Custom environment variables
自定义环境变量

Select “Local” environment, then to the right, select the settings button. This will open a dialog where you can update local environment variables. This is useful for setting project-specific variables or API keys that your development workflows require.
选择“本地”环境,然后向右选择设置按钮。这将打开一个对话框,您可以在其中更新本地环境变量。这对于设置特定于项目的变量或开发工作流所需的 API 密钥很有用。

Environment variables must be specified as key-value pairs, in .env format. For example:
环境变量必须以键值对的形式指定,格式为 .env 。例如:

API_KEY=your_api_key
DEBUG=true

# Multiline values - wrap in quotes
CERT="-----BEGIN CERT-----
MIIE...
-----END CERT-----"

六,Enterprise configuration  企业配置
Organizations can disable local Claude Code use in the desktop application with the isClaudeCodeForDesktopEnabled enterprise policy option. Additionally, Claude Code on the web can be disabled in your admin settings.
组织可以通过桌面应用程序中的 isClaudeCodeForDesktopEnabled 企业策略选项禁用本地 Claude Code 使用。此外,还可以在管理设置中禁用 Claude Code on the web。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐