安装 & 构建 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.git
cd codex/codex-rs
# 如果需要,安装 Rust 工具链
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
rustup component add rustfmt
rustup component add clippy
# 构建 Codex
cargo build
# 使用示例 prompt 启动 TUI
cargo run --bin codex -- "explain this codebase to me"
# 修改代码后,确保代码整洁
cargo fmt -- --config imports_granularity=Item
cargo clippy --tests
# 运行测试
cargo test