安裝和構建
系統要求
| 要求 | 詳情 |
|---|---|
| 操作系統 | macOS 12+、Ubuntu 20.04+/Debian 10+ 或 Windows 11 通過 WSL2 |
| Git(可選,推薦) | 2.23+ 用於內置 PR 幫助程序 |
| RAM | 最少 4GB(推薦 8GB) |
DotSlash
GitHub Release 還包含 Codex CLI 的 DotSlash 文件,名為 codex。使用 DotSlash 文件可以輕鬆地對源代碼控制進行輕量級提交,以確保所有貢獻者使用相同版本的可執行文件,無論他們用於開發的平台如何。
從源代碼構建
bash
# 克隆存儲庫並導航到 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
# 安裝工作區 justfile 使用的幫助程序工具:
cargo install just
# 可選:安裝 nextest 用於 `just test` 幫助程序(或使用 `cargo test --all-features` 作為備選)
cargo install cargo-nextest
# 構建 Codex。
cargo build
# 使用示例提示啟動 TUI。
cargo run --bin codex -- "explain this codebase to me"
# 進行更改後,使用根 justfile 幫助程序(它們預設為 codex-rs):
just fmt
just fix -p <crate-you-touched>
# 運行相關的測試(項目特定的速度最快),例如:
cargo test -p codex-tui
# 如果您安裝了 cargo-nextest,`just test` 會運行完整套件:
just test
# 否則,回退到:
cargo test --all-features