安装 & 构建 CodeX

系统要求

要求 详情
操作系统 macOS 12+、Ubuntu 20.04+/Debian 10+,或 Windows 11 通过 WSL2
Git(可选,推荐) 2.23+,用于内置的 PR 辅助工具
内存 最低 4 GB(推荐 8 GB)

DotSlash

GitHub Release 还包含一个为 Codex CLI 准备的 DotSlash 文件,文件名为 codex。 使用 DotSlash 文件可以在源码管理中提交一个轻量级的变更,以确保所有贡献者都使用同一个版本的可执行文件,而不受开发平台的影响。

从源码构建

  1. # 克隆仓库并进入 Cargo 工作区的根目录
  2. git clone https://github.com/openai/codex.git
  3. cd codex/codex-rs
  4. # 如果需要,安装 Rust 工具链
  5. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  6. source "$HOME/.cargo/env"
  7. rustup component add rustfmt
  8. rustup component add clippy
  9. # 构建 Codex
  10. cargo build
  11. # 使用示例 prompt 启动 TUI
  12. cargo run --bin codex -- "explain this codebase to me"
  13. # 修改代码后,确保代码整洁
  14. cargo fmt -- --config imports_granularity=Item
  15. cargo clippy --tests
  16. # 运行测试
  17. cargo test