PhoenixM PhoenixM
首页
AI
云原生
中间件
资源
关于我
GitHub (opens new window)

PhoenixM

首页
AI
云原生
中间件
资源
关于我
GitHub (opens new window)
  • 大语言模型

  • Agent与Skills

  • RAG检索增强

  • MCP协议

  • AI编程工具

    • AI客户端安装流程
      • 一、Claude Code
        • macOS 安装
        • Windows 安装
        • 配置 API Key
      • 二、OpenAI Codex CLI
        • macOS 安装
        • Windows 安装
        • 配置
      • 三、Google Gemini CLI
        • macOS 安装
        • Windows 安装
        • 配置
      • 四、常用命令对比
      • 五、常见问题
        • 1. 权限问题(macOS)
        • 2. 命令未找到
        • 3. Node.js 版本要求
      • 参考链接
    • Claude Code 使用手册
  • Claude Code插件

AI客户端安装流程

# AI客户端安装流程

本文档介绍主流 AI CLI 工具在 macOS 和 Windows 系统上的安装方法。


# 一、Claude Code

Claude Code 是 Anthropic 推出的官方 CLI 工具,让你在终端中与 Claude 对话并执行编码任务。

  • 官方网站:https://claude.ai/code (opens new window)
  • 官方文档:https://docs.anthropic.com/en/docs/claude-code/overview (opens new window)
  • GitHub:https://github.com/anthropics/claude-code (opens new window)

# macOS 安装

# 使用 Homebrew 安装
brew install --cask claude

# 或者使用 npm 安装
npm install -g @anthropic-ai/claude-code
1
2
3
4
5

安装完成后,运行以下命令启动:

claude
1

# Windows 安装

# 使用 npm 安装(需要 Node.js 16+)
npm install -g @anthropic-ai/claude-code
1
2

或者下载 Windows 安装包:

  1. 访问 Claude 官网 (opens new window)
  2. 下载 Windows 安装程序
  3. 双击安装包按向导完成安装

启动命令:

claude
1

# 配置 API Key

首次运行时需要配置 API Key:

claude config set apiKey sk-ant-xxxxx
1

# 二、OpenAI Codex CLI

Codex 是 OpenAI 推出的 AI 编程助手 CLI 工具。

  • 官方网站:https://openai.com/codex (opens new window)
  • 官方文档:https://platform.openai.com/docs/guides/codex (opens new window)
  • GitHub:https://github.com/openai/codex (opens new window)

# macOS 安装

# 使用 Homebrew 安装
brew install openai-codex

# 或者使用 npm 安装
npm install -g @openai/codex
1
2
3
4
5

# Windows 安装

# 使用 npm 安装
npm install -g @openai/codex
1
2

# 配置

设置 OpenAI API Key:

# macOS / Linux
export OPENAI_API_KEY="sk-xxxxx"

# Windows PowerShell
$env:OPENAI_API_KEY="sk-xxxxx"

# Windows CMD
set OPENAI_API_KEY=sk-xxxxx
1
2
3
4
5
6
7
8

# 三、Google Gemini CLI

Gemini CLI 是 Google 推出的 AI 编程命令行工具。

  • 官方网站:https://ai.google.dev/gemini-api/docs/cli (opens new window)
  • 官方文档:https://ai.google.dev/gemini-api/docs/cli (opens new window)
  • Gemini 开发者平台:https://ai.google.dev/ (opens new window)

# macOS 安装

# 使用 Homebrew 安装
brew install google-gemini

# 或者使用 npm 安装
npm install -g @google/gemini-cli
1
2
3
4
5

# Windows 安装

# 使用 npm 安装
npm install -g @google/gemini-cli
1
2

# 配置

gemini auth login
1

# 四、常用命令对比

客户端 启动命令 配置方式
Claude Code claude API Key
Codex codex API Key
Gemini CLI gemini OAuth 登录

# 五、常见问题

# 1. 权限问题(macOS)

如果遇到权限错误,尝试:

# 修复权限
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
1
2

# 2. 命令未找到

确保 npm 全局安装路径已添加到系统 PATH:

# macOS(添加到 ~/.zshrc 或 ~/.bash_profile)
export PATH="$PATH:$(npm config get prefix)/bin"

# Windows(PowerShell)
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$(npm config get prefix)", "User")
1
2
3
4
5

# 3. Node.js 版本要求

大多数 AI CLI 工具需要 Node.js 16+:

# 检查 Node 版本
node --version

# 使用 nvm 升级(macOS/Linux)
nvm install 20
nvm use 20
1
2
3
4
5
6

# 参考链接

  • Claude Code 文档 (opens new window)
  • OpenAI Codex 文档 (opens new window)
  • Gemini CLI 文档 (opens new window)
编辑 (opens new window)
上次更新: 2026/04/12, 23:32:01
Anthropic 官方 Skills 介绍与使用指南
Claude Code 使用手册

← Anthropic 官方 Skills 介绍与使用指南 Claude Code 使用手册→

最近更新
01
Anthropic 官方 Skills 介绍与使用指南
04-12
02
Claude Code 插件安装与使用指南
04-12
03
AI资源
04-02
更多文章>
Theme by Vdoing | Copyright © 2018-2026 LiFengMing | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式