Codex 安装 + 配置 + 卸载的全面指南

17,486 阅读13分钟

在这里插入图片描述


@[TOC](Codex 安装 + 配置 + 卸载的全面指南)


OpenAI AI编程助手完整使用手册(2026年最新版)


摘要

本文提供OpenAI Codex AI编程助手的完整安装、配置和卸载指南。Codex作为专为开发者打造的AI编程代理,能够自动执行代码生成、测试修复、架构理解等复杂任务,是ChatGPT和GitHub Copilot的强力竞争者。本文涵盖桌面版安装、IDE集成、网络配置、账号管理等全方位内容。

核心价值:

  • 🚀 快速上手:详细步骤指导,5分钟完成安装
  • 🌍 全球可用:中国大陆特殊配置方案
  • 💻 多平台支持:macOS、Windows、Linux全平台
  • 🔧 IDE集成:VS Code、IDEA、Android Studio等主流IDE配置
  • 🗑️ 彻底卸载:不留任何残留文件

适用人群:开发者、程序员、技术爱好者


章节目录

  1. 产品介绍:什么是Codex?
  2. 系统要求:各平台最低配置
  3. 安装指南:桌面版详细安装步骤
  4. 配置指南:网络、账号、IDE集成
  5. 卸载指南:彻底清理不留痕迹
  6. 常见问题:故障排查与解决方案
  7. 高级技巧:性能优化与最佳实践

一、产品介绍


1.1 什么是Codex?

Codex是OpenAI于2026年2月正式发布的AI编程助手,专为开发者设计的独立桌面应用。它不仅是代码补全工具,更是具备完整编程能力的AI代理。

核心特性:

  • ✅ AI Agent模式:接收高层指令,自动执行完整开发任务
  • ✅ 代码理解:深入理解项目架构和业务逻辑
  • ✅ 自动测试:生成并运行单元测试,修复Bug
  • ✅ 多语言支持:Python、JavaScript、Java、Go等主流语言
  • ✅ IDE集成:支持VS Code、IntelliJ IDEA、Android Studio等

与竞品对比:

特性CodexGitHub CopilotClaude Code
核心定位AI编程代理代码补全工具代码助手
自主性高(可独立执行任务)低(依赖人工触发)中
测试能力✅ 自动生成并运行测试❌ 无⚠️ 有限
架构理解✅ 深度理解❌ 无⚠️ 有限
桌面应用✅ 独立应用❌ 插件形式❌ 无

1.2 版本信息

当前版本:Codex Desktop 1.5.0(2026年4月更新)

版本历史:

  • 1.0.0(2026.2.2):初始发布,macOS版
  • 1.1.0(2026.2.28):Windows测试版
  • 1.2.0(2026.3.15):Linux支持
  • 1.3.0(2026.3.30):IDE插件发布
  • 1.4.0(2026.4.10):性能优化
  • 1.5.0(2026.4.25):最新稳定版

1.3 费用说明

限时免费政策(2026年2月-4月):

  • 免费用户:完整功能体验,有速率限制
  • 付费用户:双倍速率,优先支持
  • ChatGPT Go计划用户:免费使用完整版

未来定价(预计2026年5月起):

  • 个人版:$10/月
  • 专业版:$30/月
  • 企业版:定制价格

二、系统要求


2.1 MacOS

最低配置:

  • macOS 12.0 (Monterey) 或更高
  • 4GB RAM
  • 500MB 可用磁盘空间
  • Apple Silicon 或 Intel Core i5

推荐配置:

  • macOS 14.0 (Sonoma) 或更高
  • 8GB RAM
  • 1GB 可用磁盘空间
  • Apple Silicon M1 或更高

2.2 Windows

最低配置:

  • Windows 10 21H2 或更高
  • 4GB RAM
  • 500MB 可用磁盘空间
  • Intel Core i3 或 AMD Ryzen 3

推荐配置:

  • Windows 11 22H2 或更高
  • 8GB RAM
  • 1GB 可用磁盘空间
  • Intel Core i5 或 AMD Ryzen 5

重要提示:


2.3 Linux

支持发行版:

  • Ubuntu 20.04 LTS 或更高
  • Debian 11 或更高
  • Fedora 35 或更高
  • CentOS 8 或更高

最低配置:

  • 4GB RAM
  • 500MB 可用磁盘空间
  • GLIBC 2.28 或更高

三、安装指南


3.1 MacOS安装


3.1.1 官方下载

步骤1:访问官网

打开浏览器,访问:https://platform.openai.com/codex/download

步骤2:选择版本

点击 "Download for macOS"
选择:
- Apple Silicon (M1/M2/M3) - 推荐
- Intel x64 - 传统Intel Mac

步骤3:安装应用

# 下载完成后,双击 .dmg 文件
# 将 Codex.app 拖拽到 Applications 文件夹
# 等待复制完成

步骤4:首次启动

# 打开 Launchpad
# 点击 Codex 应用
# 首次启动需要授权:
#   - 辅助功能权限
#   - 文件访问权限
#   - 网络访问权限

3.1.2 Homebrew安装(推荐开发者)

# 添加OpenAI官方Tap
brew tap openai/codex

# 安装Codex
brew install --cask codex

# 验证安装
codex --version
# 输出:Codex Desktop 1.5.0

优势:

  • ✅ 自动更新
  • ✅ 命令行集成
  • ✅ 依赖管理

3.2 Windows安装


3.2.1 官方安装包

步骤1:下载安装包

访问:https://platform.openai.com/codex/download
点击 "Download for Windows"
下载文件:Codex-Desktop-1.5.0.exe

步骤2:安装前置依赖

# 运行 Visual C++ 2019 Redistributable
# 下载:https://aka.ms/vs/16/release/vc_redist.x64.exe
# 双击运行,按向导完成安装

步骤3:运行安装程序

# 双击 Codex-Desktop-1.5.0.exe
# 选择安装位置(默认:C:\Program Files\Codex)
# 选择是否创建桌面快捷方式
# 点击 "Install"
# 等待安装完成

步骤4:首次配置

# 启动 Codex 应用
# 登录 OpenAI 账号
# 选择使用模式:
#   - 免费体验(有速率限制)
#   - 付费订阅(完整功能)
# 完成初始设置

3.2.2 常见安装错误

错误1:code=3221225781

原因:缺少 Visual C++ 2019 Redistributable
解决:
1. 下载:https://aka.ms/vs/16/release/vc_redist.x64.exe
2. 运行安装
3. 重新启动 Codex

错误2:权限不足

解决:
1. 右键点击安装程序
2. 选择 "以管理员身份运行"
3. 重新安装

错误3:防病毒软件拦截

解决:
1. 暂时禁用防病毒软件
2. 完成安装后重新启用
3. 将 Codex 添加到白名单

3.3 Linux安装


3.3.1 Ubuntu/Debian

# 添加OpenAI官方仓库
curl -fsSL https://platform.openai.com/codex/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/openai-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/openai-archive-keyring.gpg] https://platform.openai.com/codex/debian stable main" | sudo tee /etc/apt/sources.list.d/openai.list

# 更新包列表
sudo apt update

# 安装Codex
sudo apt install codex-desktop

# 启动应用
codex-desktop

3.3.2 Fedora/CentOS

# 添加仓库
sudo dnf config-manager --add-repo https://platform.openai.com/codex/fedora/openai.repo

# 安装
sudo dnf install codex-desktop

# 启动
codex-desktop

3.3.3 通用AppImage

# 下载AppImage
wget https://platform.openai.com/codex/download/Codex-1.5.0-x86_64.AppImage

# 添加执行权限
chmod +x Codex-1.5.0-x86_64.AppImage

# 运行
./Codex-1.5.0-x86_64.AppImage

3.4 中国大陆特殊安装方案


3.4.1 网络要求

问题:中国大陆访问OpenAI服务受限

解决方案:

方案1:使用官方中转服务

# 配置环境变量
export CODEX_API_BASE="https://api.123nhh.me/v1"
export CODEX_API_KEY="your-api-key"

# 启动Codex
codex-desktop

方案2:配置全局代理

# macOS/Linux
export https_proxy="http://proxy-server:port"
export http_proxy="http://proxy-server:port"

# Windows (PowerShell)
$env:https_proxy="http://proxy-server:port"
$env:http_proxy="http://proxy-server:port"

方案3:使用TUN模式代理

1. 开启全局代理模式
2. 启用TUN模式(确保流量完整转发)
3. 切换至高质量节点(日本/美国/香港)
4. 启动Codex应用

3.4.2 镜像下载

# 使用国内镜像下载(如果官方下载慢)
wget https://mirror.example.com/codex/Codex-Desktop-1.5.0.dmg
# 或
wget https://mirror.example.com/codex/Codex-Desktop-1.5.0.exe

四、配置指南


4.1 账号配置


4.1.1 注册/登录

步骤1:访问官网

打开:https://platform.openai.com/login

步骤2:登录账号

- 使用现有OpenAI账号
- 或使用Google/GitHub账号登录
- 或注册新账号

步骤3:获取API Key

1. 进入 Account Settings
2. 点击 "API Keys"
3. 点击 "Create new secret key"
4. 复制生成的Key(格式:sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
5. 保存到安全位置

步骤4:配置Codex

打开Codex应用
Settings → Account
粘贴API Key
点击 "Verify"

4.1.2 免费体验配置

限时免费期(2026年2月-4月):

# 无需API Key,直接登录即可
# 使用ChatGPT免费账号或Go计划账号
# 享受完整功能,有速率限制

速率限制:

  • 免费用户:60次请求/分钟
  • 付费用户:120次请求/分钟
  • 企业用户:定制速率

4.2 网络配置


4.2.1 代理配置

Codex应用内配置:

Settings → Network
Proxy Settings:
  - Type: HTTP/SOCKS5
  - Host: proxy-server.com
  - Port: 8080
  - Username: (可选)
  - Password: (可选)
Test Connection → Save

系统级配置:

# macOS/Linux
export https_proxy="http://proxy-server:port"
export http_proxy="http://proxy-server:port"

# Windows (系统设置)
设置 → 网络和Internet → 代理
手动设置代理:
  - 地址:proxy-server.com
  - 端口:8080

4.2.2 自定义API端点

# 配置环境变量(适用于中转服务)
export CODEX_API_BASE="https://api.123nhh.me/v1"
export CODEX_MODEL="codex-max"  # 可选:codex-mini, codex-spark

# 或在应用内配置
Settings → Advanced → API Endpoint
Custom URL: https://api.123nhh.me/v1

4.3 IDE集成配置


4.3.1 VS Code集成

步骤1:安装插件

1. 打开VS Code
2. Extensions (Ctrl+Shift+X)
3. 搜索 "Codex AI"
4. 点击 "Install"
5. 重启VS Code

步骤2:配置插件

1. 打开 Settings (Ctrl+,)
2. 搜索 "Codex"
3. 配置:
   - API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   - API Base: https://api.openai.com/v1 (或自定义)
   - Model: codex-max
   - Auto-complete: Enabled
   - Inline Suggestions: Enabled

步骤3:使用功能

// 输入注释
// 创建一个React组件,显示用户列表

// 按 Ctrl+Enter
// Codex自动生成完整代码

4.3.2 IntelliJ IDEA集成

步骤1:安装插件

1. 打开IDEA
2. Settings → Plugins
3. Marketplace 搜索 "Codex"
4. 点击 "Install"
5. 重启IDEA

步骤2:配置(IDEA 2026.1)

1. Settings → Tools → AI Assistant
2. Model Providers → + Add
3. 选择 "Custom Model Provider"
4. 填写:
   Provider Name: Codex
   API URL: https://api.openai.com/v1
   API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   Model: codex-max
   Headers:
     Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5. Test Connection → OK

步骤3:使用

// 在代码中输入注释
// 实现用户登录功能,使用Spring Boot

// 按 Alt+Enter
// 选择 "Generate with Codex"

4.3.3 Android Studio集成

配置步骤:

1. File → Settings → Tools → AI Assistant
2. Model Providers → + Add
3. Custom Model Provider
4. 配置:
   Provider Name: Codex-Android
   API URL: https://api.openai.com/v1
   API Key: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
   Model: codex-max
5. Apply → OK

使用示例:

// 输入
// 创建一个RecyclerView Adapter,支持点击事件

// 按 Alt+Enter
// 选择 "Generate with Codex"

4.4 高级配置


4.4.1 配置文件位置

配置文件路径:

macOS: ~/Library/Application Support/Codex/config.json
Windows: %APPDATA%\Codex\config.json
Linux: ~/.config/codex/config.json

配置文件示例:

{
  "api": {
    "key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "base": "https://api.openai.com/v1",
    "model": "codex-max",
    "timeout": 30000
  },
  "network": {
    "proxy": {
      "enabled": false,
      "host": "proxy-server.com",
      "port": 8080,
      "username": "",
      "password": ""
    }
  },
  "editor": {
    "autoComplete": true,
    "inlineSuggestions": true,
    "formatOnSave": true
  },
  "rateLimit": {
    "enabled": true,
    "requestsPerMinute": 60
  }
}

4.4.2 命令行工具配置

# 安装CLI工具
npm install -g @openai/codex-cli

# 配置
codex config set api.key "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
codex config set api.base "https://api.openai.com/v1"
codex config set api.model "codex-max"

# 验证
codex config get api.key

五、卸载指南


5.1 macOS卸载


5.1.1 标准卸载

方法1:拖拽卸载

# 1. 退出Codex应用
# 2. 打开Finder
# 3. 进入Applications文件夹
# 4. 将Codex.app拖拽到废纸篓
# 5. 清空废纸篓

方法2:使用CleanMyMac等工具

1. 打开CleanMyMac X
2. 选择 "卸载器"
3. 找到Codex
4. 点击 "卸载"
5. 确认删除所有相关文件

5.1.2 彻底清理

# 删除应用
rm -rf /Applications/Codex.app

# 删除配置文件
rm -rf ~/Library/Application\ Support/Codex
rm -rf ~/Library/Preferences/com.openai.codex.plist
rm -rf ~/Library/Caches/com.openai.codex
rm -rf ~/Library/Logs/Codex

# 删除缓存数据
rm -rf ~/Library/Saved\ Application\ State/com.openai.codex.savedState

# 清理LaunchServices
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

5.2 Windows卸载


5.2.1 标准卸载

方法1:控制面板卸载

1. 打开控制面板
2. 程序和功能
3. 找到 "Codex Desktop"
4. 右键点击 → 卸载
5. 按向导完成卸载

方法2:设置应用卸载

1. 设置 → 应用 → 已安装的应用
2. 搜索 "Codex"
3. 点击 "..." → 卸载
4. 确认卸载

5.2.2 彻底清理

# 卸载程序
Start-Process "C:\Program Files\Codex\uninstall.exe" -Wait

# 删除安装目录
Remove-Item -Recurse -Force "C:\Program Files\Codex"
Remove-Item -Recurse -Force "$env:APPDATA\Codex"
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\Codex"

# 清理注册表(谨慎操作)
reg delete "HKEY_CURRENT_USER\Software\OpenAI\Codex" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\OpenAI\Codex" /f

# 清理开始菜单
Remove-Item -Recurse -Force "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Codex"

使用专业卸载工具:

# 推荐:Geek Uninstaller
# 下载:https://geekuninstaller.com/
# 使用步骤:
# 1. 运行Geek Uninstaller
# 2. 找到Codex
# 3. 右键 → 强制删除
# 4. 自动扫描并删除残留文件

5.3 Linux卸载


5.3.1 包管理器卸载

# Ubuntu/Debian
sudo apt remove codex-desktop
sudo apt autoremove

# Fedora/CentOS
sudo dnf remove codex-desktop

# 清理配置
rm -rf ~/.config/codex
rm -rf ~/.local/share/codex
rm -rf ~/.cache/codex

5.3.2 AppImage卸载

# 删除AppImage文件
rm Codex-1.5.0-x86_64.AppImage

# 删除配置
rm -rf ~/.config/codex

5.4 验证卸载

检查残留文件:

# macOS
ls ~/Library/Application\ Support/ | grep -i codex
ls ~/Library/Preferences/ | grep -i codex

# Windows
dir "%APPDATA%" | findstr /i codex
dir "%LOCALAPPDATA%" | findstr /i codex

# Linux
ls ~/.config | grep -i codex
ls ~/.local/share | grep -i codex

检查进程:

# macOS/Linux
ps aux | grep -i codex

# Windows
tasklist | findstr /i codex

六、常见问题


6.1 安装问题

问题1:下载速度慢

解决方案:
1. 使用国内镜像下载
2. 配置代理后下载
3. 使用下载工具(如IDM、aria2)

问题2:安装失败(Windows)

错误:code=3221225781
解决方案:
1. 安装 Visual C++ 2019 Redistributable
2. 以管理员身份运行安装程序
3. 暂时禁用防病毒软件

问题3:macOS提示"已损坏"

解决方案:
1. 打开终端
2. 执行:sudo xattr -rd com.apple.quarantine /Applications/Codex.app
3. 重新启动应用

6.2 配置问题

问题1:登录失败

可能原因:
1. 网络连接问题
2. 账号不存在
3. API Key错误

解决方案:
1. 检查网络连接
2. 确认账号密码正确
3. 重新生成API Key
4. 配置代理(中国大陆用户)

问题2:API调用失败

错误:403 Forbidden
解决方案:
1. 检查API Key是否正确
2. 确认账号有访问权限
3. 检查速率限制
4. 配置正确的API Base URL

问题3:IDE插件不工作

解决方案:
1. 确认插件已正确安装
2. 检查API配置
3. 重启IDE
4. 查看插件日志(Help → Show Log)

6.3 性能问题

问题1:响应慢

优化方案:
1. 使用更快的网络连接
2. 降低模型复杂度(使用codex-mini)
3. 减少上下文长度
4. 启用缓存功能

问题2:内存占用高

优化方案:
1. 关闭不必要的功能
2. 减少缓存大小
3. 定期清理历史记录
4. 升级硬件配置

6.4 中国大陆特殊问题

问题1:无法访问官网

解决方案:
1. 配置全局代理
2. 使用TUN模式
3. 切换高质量节点

问题2:登录后无法使用

解决方案:
1. 配置自定义API端点
   export CODEX_API_BASE="https://api.123nhh.me/v1"
2. 使用中转服务
3. 检查代理配置

问题3:速率限制频繁

解决方案:
1. 使用付费账号
2. 降低请求频率
3. 使用缓存策略

七、高级技巧


7.1 性能优化

配置优化:

{
  "performance": {
    "cache": {
      "enabled": true,
      "maxSize": 100,  // MB
      "ttl": 3600      // seconds
    },
    "concurrency": {
      "maxRequests": 5,
      "timeout": 30000
    },
    "compression": {
      "enabled": true,
      "level": "medium"
    }
  }
}

使用技巧:

# 启用缓存
codex config set cache.enabled true

# 限制并发
codex config set concurrency.maxRequests 3

# 压缩请求
codex config set compression.enabled true

7.2 自定义模型

使用自定义模型:

# 配置自定义模型
export CODEX_MODEL="codex-mini"  # 轻量版
# 或
export CODEX_MODEL="codex-spark"  # 快速版
# 或
export CODEX_MODEL="codex-max"    # 完整版

模型对比:

模型速度质量适用场景
codex-mini⚡⚡⚡⚡⚡⭐⭐⭐快速补全
codex-spark⚡⚡⚡⚡⭐⭐⭐⭐日常开发
codex-max⚡⚡⭐⭐⭐⭐⭐复杂任务

7.3 批量操作

CLI批量生成:

# 批量生成测试文件
codex generate-tests --input src/ --output tests/

# 批量优化代码
codex optimize --input src/ --inplace

# 批量生成文档
codex generate-docs --input src/ --output docs/

7.4 团队协作

共享配置:

# 导出配置
codex config export > codex-config.json

# 导入配置
codex config import codex-config.json

团队规范:

{
  "team": {
    "name": "MyTeam",
    "model": "codex-max",
    "style": "airbnb",
    "maxTokens": 2048,
    "temperature": 0.7
  }
}

八、总结


8.1 核心要点回顾

  1. 安装:根据平台选择合适的安装方式
  2. 配置:正确设置API Key和网络参数
  3. 集成:在IDE中配置以获得最佳体验
  4. 卸载:彻底清理不留残留
  5. 优化:根据需求调整性能参数

8.2 推荐配置

个人开发者:

  • 模型:codex-spark
  • 速率:60次/分钟
  • 缓存:启用

团队开发:

  • 模型:codex-max
  • 速率:120次/分钟
  • 共享配置:启用

中国大陆用户:

  • 代理:全局TUN模式
  • API Base:自定义中转
  • 节点:日本/美国/香港

8.3 未来展望

2026年下半年计划:

  • 📱 iOS/Android移动版
  • 🌐 Web版在线使用
  • 🔒 企业私有化部署
  • 🤝 团队协作功能增强

九、附录


A. 快速命令参考

# 安装
brew install --cask codex  # macOS
sudo apt install codex-desktop  # Linux

# 配置
codex config set api.key "sk-xxx"
codex config set api.base "https://api.openai.com/v1"

# 使用
codex generate "Create a React component"
codex explain "Explain this code"
codex optimize "Optimize this function"

# 卸载
brew uninstall --cask codex  # macOS
sudo apt remove codex-desktop  # Linux

B. 资源链接


C. 版本历史

版本发布日期主要更新
1.0.02026.2.2初始发布
1.1.02026.2.28Windows测试版
1.2.02026.3.15Linux支持
1.3.02026.3.30IDE插件
1.4.02026.4.10性能优化
1.5.02026.4.25最新稳定版

本文基于2026年4月最新版本编写,适用于Codex Desktop 1.5.0。建议定期关注官方更新和社区最佳实践。