安装 & 构建 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 文件可以在源码管理中提交一个轻量级的变更,以确保所有贡献者都使用同一个版本的可执行文件,而不受开发平台的影响。
从源码构建
# 克隆仓库并进入 Cargo 工作区的根目录git clone https://github.com/openai/codex.gitcd codex/codex-rs# 如果需要,安装 Rust 工具链curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -ysource "$HOME/.cargo/env"rustup component add rustfmtrustup component add clippy# 构建 Codexcargo build# 使用示例 prompt 启动 TUIcargo run --bin codex -- "explain this codebase to me"# 修改代码后,确保代码整洁cargo fmt -- --config imports_granularity=Itemcargo clippy --tests# 运行测试cargo test
