安裝與更新 Codex CLI:Mac、Linux、Windows
安裝 OpenAI Codex CLI 每個平台只要一條命令:macOS 與 Linux 上是 curl -fsSL https://chatgpt.com/codex/install.sh | sh,Windows 上是 powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex",npm 與 Homebrew 則是受支援的替代方案;更新是 codex update,它能辨識指令碼、npm 與 Homebrew 安裝並執行該通道的升級。1411 大多數頁面略過的,是第一條命令之後的事:五種安裝路徑該選哪一種、某個版本出問題時怎麼鎖定版本、winget 套件為什麼比 npm 落後幾天到幾週,以及移除之後 ~/.codex 裡會留下什麼。本頁就是那份參考:每項工作一張表,以 v0.163.0(2026 年 10 月 15 日)為準。9
2026 年 10 月 15 日更新,適用於 v0.163.0。 自本頁 9 月版以來,有四處變化。首先是 winget 索引有了動靜:在 manifest 請求一擱就是數週的夏天之後,0.156.0 到 0.161.0 的 12 個請求都在開啟後一天內合併,但 0.162.0 與 0.162.1 的請求從 10 月 8 日和 9 日起一直在等待,所以 10 月 15 日 winget 比 npm 落後 3 個版本,而 9 月 6 日落後的是 14 個(0.147.0 到 0.153.4)。310 Windows 版本現在隨附經過簽署的 install.ps1(它的 SHA-256 檢查早已存在,v0.162.0 修正了它在 Windows PowerShell 下的問題)。18 Windows 也多了第三種沙箱實作 Microsoft Execution Containers,9 月時的兩種模式成了它的備援。8 此外,Codex 現在會為符合條件的互動式工作階段預設啟動背景伺服器,它執行自己的更新程式,在較舊的指令碼安裝上可能連 CLI 本身的套件也一併變動。20 下文所有關於安裝、更新與鎖定版本的基準都在 10 月 15 日重新查證過;codex doctor 的內容仍是 0.153.4 上的讀數。910
TL;DR
- 獨立安裝程式是 OpenAI 領頭推薦的路徑,README 與 CLI 文件皆然,npm 與 Homebrew 則作為替代方案呈現(CLI 文件寫的是「you can also install」,README 寫的是「can also be installed via」):macOS 與 Linux 用
install.sh指令碼,Windows 用install.ps1指令碼。它下載的是編譯好的二進位檔,所以不需要 Node。111 - npm 與 Homebrew 是受支援的替代方案。
npm install -g @openai/codex用一般的套件規格(@<version>)鎖定版本;撰寫本文時brew install --cask codex與 npm 同為 0.163.0;cask 在該版本發布 13 分鐘後完成更新。1210 - winget 能用,但落後幾天到幾週。 OpenAI 發布了
OpenAI.Codex套件。在 manifest pull request 一積壓就是數週的夏天之後,0.156.0(2026 年 9 月 22 日)到 0.161.0(10 月 7 日)的 12 個請求都在開啟後一天內合併;隨後 0.162.0 與 0.162.1 的請求停滯,從 10 月 8 日和 9 日起一直開著。10 月 15 日可安裝的最新版本是 0.161.0,而 npm 是 0.163.0,落後 3 個穩定版,0.163.0 的請求也還開著。310 codex update涵蓋指令碼、npm 與 Homebrew 安裝(v0.128.0 起):它重用 TUI 既有的安裝通道偵測,並執行對應的升級。winget 安裝不在它辨識的通道之列;那一種請用winget upgrade OpenAI.Codex更新。其餘的手動對應做法是重新執行安裝程式、npm install -g @openai/codex@latest,或brew upgrade --cask codex。411- 背景伺服器執行著一個更新程式,在較舊的指令碼安裝上它可能變動你的 CLI。 從 v0.157.0(2026 年 9 月 25 日 UTC)起,Codex 會為符合條件的互動式工作階段預設啟動一個受管理的背景伺服器。如果安裝程式選擇的是
latest通道,該伺服器會在啟動 5 分鐘後檢查更新,之後每小時檢查一次,並執行安裝程式;新的常駐程式位於~/.codex/packages/app-server-daemon底下,但最初從較舊指令碼安裝啟動的常駐程式會繼續使用 CLI 本身的套件~/.codex/packages/standalone/current。開關是~/.codex/app-server-daemon/settings.json裡的"updater": { "autoUpdateEnabled": false },由codex app-server daemon restart讓它生效。2012 - 鎖定版本:
install.sh用--release <version>,install.ps1那一行之前用$env:CODEX_RELEASE,npm 用@<version>。 Homebrew 的 cask 只追蹤一個當前版本,無法鎖定。212 - 移除套件不會清掉你的狀態, 但在指令碼安裝上,
rm -rf ~/.codex也會把 CLI 本身刪掉,因為安裝程式把各個版本放在~/.codex/packages/standalone底下。12
如何安裝 Codex CLI?
按 OpenAI 自家文件的呈現順序列出四條路徑,111 再加上 OpenAI 沒有文件化的 Windows winget:3
# Standalone installer, no Node required (macOS, Linux, WSL) -- the route OpenAI lists first
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
# npm (needs Node.js 16+; pins with a plain @version spec)
npm install -g @openai/codex
# Homebrew (macOS, Linux)
brew install --cask codex
# winget (Windows; lags npm, see the platform section)
winget install OpenAI.Codex
接著確認安裝成功並登入:
codex --version # codex-cli 0.163.0
codex login # ChatGPT account (recommended) or an API key
第一次用指令碼安裝時,profile 區塊只在新開的 shell 生效。如果在安裝時所用的終端機裡找不到 codex,在那裡執行 export PATH="$HOME/.local/bin:$PATH",或者開一個新的終端機;安裝程式結束時會印出同樣的兩行(「Current terminal」與「Future terminals」)。12
想直接用二進位檔?每個 GitHub release 都附帶各平台的 tarball(codex-aarch64-apple-darwin.tar.gz、codex-x86_64-apple-darwin.tar.gz、codex-x86_64-unknown-linux-musl.tar.gz、codex-aarch64-unknown-linux-musl.tar.gz),而且從 v0.106.0 起,同一份 install.sh 也作為資產附在每個 release 上。每個壓縮檔只含一個把平台名稱嵌在檔名裡的項目,所以解壓後把它改名為 codex。15 發布頁圍繞這些 tarball 又多了不少東西:每個二進位檔的 .zst 與 macOS .dmg 同類檔案;把二進位檔、codex-code-mode-host 輔助程式與 ripgrep 打包在一起的 codex-package-<target>.tar.gz,安裝程式與 Homebrew cask 下載的正是它們;codex-app-server 與 codex-responses-api-proxy 二進位檔;以及 openai_codex_cli_bin Python wheel,它們是 OpenAI Python SDK 固定版本的執行環境,而不是用 pip 安裝 CLI 的途徑。512
安裝程式從 OpenAI 自家託管的發布基礎設施抓取:chatgpt.com/codex/install.sh 會重新導向到 releases.openai.com,這項變更在 v0.146.0 落地,GitHub Releases 保留為備援主機。6 在封鎖或限速 OpenAI 產物主機、但允許 GitHub 的網路上,改從 release 資產抓指令碼,並告訴它二進位檔也從 GitHub 拉:112
curl -fsSL https://github.com/openai/codex/releases/latest/download/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh
變數要放在管線的 sh 那一側。VAR=value curl ... | sh 這種寫法只把變數套用到 curl,指令碼根本看不到它,就悄悄沿用預設值。在 PowerShell 裡,執行安裝那一行之前先設定 $env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM = 'false'。
該選哪一條路徑?
| 你的環境 | 使用 | 原因 |
|---|---|---|
| macOS 或 Linux | 安裝指令碼 | OpenAI 文件列在第一位的路徑;下載二進位檔,機器上不需要 Node11 |
| Windows | PowerShell 指令碼 | 原生 PowerShell 搭配 Windows 沙箱;WSL 可有可無811 |
| 任何在指令碼裡鎖定版本的機器 | npm install -g @openai/codex@<version> |
以套件規格鎖定,版本寫在你的 Dockerfile 或佈建指令碼裡,而不是寫在旗標裡10 |
| Homebrew 已經管理一切的 macOS 或 Linux | brew install --cask codex |
10 月 15 日與 npm 同版本(cask 在發布 13 分鐘後更新)、無 Node 相依,brew upgrade 保持最新2 |
| 以套件管理的 Windows | winget install OpenAI.Codex |
能接受落後於 npm 時(10 月 15 日落後 3 個版本)3 |
Codex 支援哪些平台?
| 平台 | 狀態 |
|---|---|
| macOS,Apple silicon 與 Intel | 支援;兩者都有二進位檔1 |
| Linux,x86_64 與 arm64 | 支援;兩者都有二進位檔1 |
| Windows 11 | 建議的基準;MXC 隨 24H2(build 26100.9278)與 25H2(build 26200.9278)推出,且仍在逐步推送,請用一條命令的測試確認8 |
| Windows 10,1809 或更新版本 | 盡力支援(需要 ConPTY 主控台支援)8 |
| 更舊的 Windows 10 | 不建議:缺少主控台元件8 |
| WSL2 | 可選;OpenAI 的 WSL 頁面在 WSL shell 裡執行同一份安裝指令碼14 |
在 Windows 上,Codex 以原生方式在 PowerShell 裡搭配 Windows 沙箱執行,截至 2026 年 10 月共有三種實作。最新的是 Microsoft Execution Containers(MXC),也就是 Microsoft 在 Windows 11 24H2 與 25H2 引入的行程隔離:桌面應用程式在裝置支援時會為消費者帳戶優先使用它;CLI 則在 [features] 底下設定 prefer_mxc = true 時使用它,此時以舊有模式作為備援,或者在 [windows] sandbox = "mxc" 明確選擇它時使用,這種情況下若缺少該能力或遭原則封鎖,會直接失敗而不會退回;從 v0.162.0 起,一條命令的測試(codex -c windows.sandbox=mxc sandbox ...,預期輸出 MXC_OK)可以在不改變已儲存選擇的情況下試用它。原先的兩種模式現在是舊有的備援。elevated 是偏好的模式:它使用專屬的低權限沙箱使用者、檔案系統權限邊界、防火牆規則與本機原則變更,需要管理員核准的設定。unelevated 用衍生自你使用者的受限 Windows token 以及以 ACL 為基礎的檔案系統邊界來執行命令,網路隔離較弱。8 備援模式在 config.toml 裡選擇:
[windows]
sandbox = "elevated" # or "unelevated"; "mxc" selects the containers explicitly
OpenAI 的指引是預設使用原生沙箱,在你需要 Linux 原生工具、工作流程本來就在 WSL2 裡,或所有原生 Windows 沙箱實作都不合用時才選 WSL。8 有一點要分清楚:Windows 設定假定機器上有 winget 供它自己的設定步驟使用;這和透過 winget 安裝 Codex 是兩回事。OpenAI 確實發布了那個套件,發布工作流程裡有一個 winget 工作,會為穩定版在 microsoft/winget-pkgs 開 manifest pull request,而索引在夏天的停滯已經結束,只是並非從此一勞永逸。此處日期均為 UTC。0.148.0 到 0.152.0 的請求在 8 月 18 日到 9 月 1 日之間開啟,於 9 月 11 日合併(0.151.0 在 9 月 30 日,0.149.1 在 10 月 1 日);0.147.0 的請求未合併即關閉,一位社群成員提交的 0.154.0 也是如此,而 OpenAI 的工作流程沒有為 0.152.1 以及 0.153.x 到 0.155.x 開過任何請求;從 0.156.0(9 月 22 日)到 0.161.0(10 月 7 日),連續 12 個 manifest 都在開啟後一天內合併;隨後 0.162.0 與 0.162.1 的請求停滯,從 10 月 8 日和 9 日起一直開著。10 月 15 日,索引裡有 138 個版本,最新為 0.161.0,比 npm 落後 3 個穩定版,0.163.0 的請求也還開著。CLI 本身沒壞,只是這個套件會落後幾天到幾週。38
Node.js 只有 npm 路徑才需要。安裝指令碼下載的是編譯好的二進位檔,而 Homebrew cask 沒有宣告任何相依。12
如何更新 Codex CLI?
你執行的 CLI 不會自我更新,除非有背景伺服器的更新程式在管理同一個套件(也就是伺服器從 packages/standalone 啟動的較舊指令碼安裝,見下文)。TUI 會注意到新版本,並提供符合你安裝通道的命令;執行與否取決於你,內建的那條涵蓋指令碼、npm 與 Homebrew 安裝。4 啟動時的檢查本身是一個設定鍵:config.toml 裡的 check_for_update_on_startup = false,參考文件把它描述為「Check for Codex updates on startup (set to false only when updates are centrally managed)」;集中管理更新的組織則在 requirements.toml 設定 features.in_app_updates = false。16
codex --version # what you run now
npm view @openai/codex version # newest published
codex update # built-in, v0.128.0+; detects your install channel
codex update 在 2026 年 4 月 30 日隨 v0.128.0 出現;加入它的 pull request 重用了 TUI 原本用於更新提示的安裝通道偵測與更新執行器。通道對照涵蓋 npm(加上 bun、pnpm 與 Vite+ 變體)、Homebrew,以及 Unix 與 Windows 上的獨立安裝程式;winget 安裝不在其中,所以透過 winget 安裝的 Codex 只能用 winget upgrade OpenAI.Codex 更新。10 月 15 日重新讀取時,對照裡多了一項:一個在終端機還原後替換本機背景伺服器的常駐程式動作;獨立安裝的命令現在也會帶著 CODEX_NON_INTERACTIVE=1 執行安裝程式;winget 仍不在其中。4 如果你偏好手動,或正在為機器映像寫指令碼,手動對應做法如下:
curl -fsSL https://chatgpt.com/codex/install.sh | sh # standalone: re-run the installer
npm install -g @openai/codex@latest # npm
brew upgrade --cask codex # Homebrew
winget upgrade OpenAI.Codex # winget (to whatever winget has)
irm https://chatgpt.com/codex/install.ps1 | iex # standalone on Windows: re-run the installer
版本在一條快速的穩定線上發布:0.160.0 到 0.163.0 共 6 個穩定版,在 2026 年 10 月 1 日到 10 月 15 日之間出爐,所以「我在用的」與「最新的」之間的差距往往是一週,而不是一季。9
背景伺服器會自我更新
背景伺服器是唯一會按排程抓取新二進位檔的東西。從 v0.157.0(2026 年 9 月 25 日 UTC)起,Codex 會為符合條件的互動式工作階段預設啟動一個受管理的背景伺服器;如果安裝程式選擇的是穩定的 latest 通道,該伺服器會啟動一個分離的更新迴圈:它在啟動 5 分鐘後檢查更新,之後每小時一次,每次都執行安裝程式,而執行中的伺服器會換用新的二進位檔重新啟動。在 0.163.0 上安裝的常駐程式位於自己的套件 ~/.codex/packages/app-server-daemon 中(這是安裝程式的 CODEX_INSTALL_DAEMON_ONLY=1 模式,不會動到使用者的 CLI 命令與 shell 設定),但最初從較舊指令碼安裝啟動的常駐程式會繼續使用 ~/.codex/packages/standalone/current,它的排程更新變動的就是這個套件,也就是你輸入的那個 CLI(對於早於安裝程式通道標記的安裝,要等下一次 latest 安裝之後才會如此,而這次安裝由 codex update 執行;在那之前,常駐程式只提供服務而不更新)。鎖定的版本會維持鎖定:安裝程式只在 latest 安裝時寫入 auto-update-version 標記,在明確指定版本時將其刪除,指令碼自己的註解也寫明了這條規則:「Scheduled updates still require the selected release to follow the latest channel.」以使用者為單位的開關是 ~/.codex/app-server-daemon/settings.json 裡的 "updater": { "autoUpdateEnabled": false },旁邊還有 updateIntervalMinutes;codex app-server daemon restart 會套用啟用狀態,修改後的間隔則從下一次等待開始生效;codex app-server daemon stop 會停止伺服器(先送出正常終止請求,超過寬限期後強制終止;更新迴圈是一個以 pid 管理的獨立行程,所以停止後要檢查它),TUI 裡的 /daemon 會重新啟動伺服器(v0.163.0),這些更新也遵守應用程式的網路原則(v0.163.0)。明確執行 codex app-server daemon update,即使在自動更新關閉時也會選擇最新的穩定版,並在安裝程式與版本支援時,把舊有常駐程式遷到它自己的套件根目錄;它還會讓鎖定的套件重新納入正式版更新的範圍(自動更新設定本身維持不變),並重新啟動執行中的伺服器,這可能中斷進行中或排隊中的工作;已停止的伺服器則維持停止。常駐程式自己的 README 稱它為實驗性功能。2012
如何安裝特定版本?
npm 與安裝指令碼都能按版本鎖定;Homebrew 不行:212
npm install -g @openai/[email protected] # npm: exact version
curl -fsSL https://chatgpt.com/codex/install.sh | sh -s -- --release 0.162.1 # script: --release flag
curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_RELEASE=0.162.1 sh # script: env var, on the sh side
winget install OpenAI.Codex --version 0.161.0 # winget: only what it has
codex --version # verify the rollback took
注意環境變數寫法的位置:CODEX_RELEASE=0.162.1 必須放在管線之後、sh 之前。寫在 curl 前面,變數只作用於 curl,指令碼會在你以為已經鎖定的時候安裝 latest。12 在 Windows 上,PowerShell 指令碼把 $Release = $env:CODEX_RELEASE 宣告為唯一的參數,為空時退回 latest,所以鎖定就是那個變數,在同一個工作階段裡設定:17
$env:CODEX_RELEASE = '0.162.1'; irm https://chatgpt.com/codex/install.ps1 | iex
用完後請清除它(Remove-Item Env:CODEX_RELEASE):這個變數會在該工作階段剩下的時間裡一直保持設定,之後在同一工作階段中執行的安裝程式,包括 codex update 啟動的那一次,都會沿用這個鎖定。17
npm 也為預先發布線提供了一個 alpha dist-tag(10 月 15 日為 0.163.0-alpha.11,於 10 月 14 日 UTC 發布,比穩定版 0.163.0 早了將近兩天);npm install -g @openai/codex@alpha 會跟隨它,而從 v0.161.0 起,發布較舊的 alpha 或修補版本不再會讓這個標籤倒退。1021
當某個版本讓你出問題時,鎖定版本是正確的做法:回報 issue,鎖回最後一個正常的版本,繼續往前。每次鎖定後都用 codex --version 驗證,因為 PATH 上別處的第二份安裝會默默繼續提供它自己的二進位檔。安裝指令碼正是在檢查這件事:當它在你的 PATH 上發現已有 Homebrew、npm 或 bun 管理的 codex 時,會警告「Multiple managed Codex installs can be ambiguous because PATH order decides which one runs」,並主動提議替你執行對應的移除命令;它靠 macOS 前綴 /opt/homebrew 與 /usr/local 辨識 Homebrew 的情況,而且只在 macOS 上這麼做,所以 Linuxbrew 的 codex 不會被發現。12 事後 codex doctor 會在 Environment 底下回報同樣的狀況。7
如何移除 Codex CLI?
先趁 codex 還在你的 PATH 上時停止背景伺服器,再用安裝它的那條路徑來移除:
codex app-server daemon stop # first; skip if no server runs
npm uninstall -g @openai/codex
brew uninstall --cask codex
winget uninstall OpenAI.Codex
指令碼安裝沒有套件管理器可問。安裝程式在 ~/.local/bin 放一個 codex 符號連結(可用 CODEX_INSTALL_DIR 覆寫),指向 ~/.codex/packages/standalone/current 裡的二進位檔(目前版本是 current/bin/codex);current 本身又是指向 ~/.codex/packages/standalone/releases/ 的符號連結,每個下載的版本都放在那裡。在 macOS 上,安裝程式會在第一個連結旁邊再加一個符號連結 codex-code-mode-host。12 從 v0.157.0 起,可能還有一個背景伺服器:它的套件在 ~/.codex/packages/app-server-daemon 底下(如果伺服器最初是從較舊的安裝啟動,則就是 standalone 套件本身),狀態在 ~/.codex/app-server-daemon/ 底下(settings.json,daemon.pid 與 daemon-updater.pid,或者對從 standalone 套件執行的伺服器而言是 app-server.pid 與 app-server-updater.pid,以及 daemon.lock)。20 先停止它,再全部移除:
codex app-server daemon stop # the background server; its updater is a separate process
pgrep -fl "app-server" || true # what is still running
grep -H . ~/.codex/app-server-daemon/*.pid 2>/dev/null # the recorded pids, by file
伺服器以 codex app-server --listen unix:// 執行,開啟遠端控制時在 --listen 之前還有 --remote-control(listen 參數只是一個單純的 scheme,命令列上看不到 socket 路徑),更新程式則以 codex app-server daemon pid-update-loop 執行;判斷哪個行程屬於背景伺服器,要看 ~/.codex/app-server-daemon/ 底下的 pid 檔案:專用常駐程式是 daemon.pid 與 daemon-updater.pid,從 standalone 套件執行的伺服器是 app-server.pid 與 app-server-updater.pid。stop 結束的是伺服器,而不是更新程式,後者會按間隔持續醒來,直到機器重新開機,所以如果那裡記錄的某個 pid 仍然存活,現在就用 kill <pid> 結束它;其他任何 codex app-server 行程都屬於你正在執行的別的東西。接著移除其餘部分:1220
rm -f ~/.local/bin/codex ~/.local/bin/codex-code-mode-host # the second link exists on macOS installs only
rm -rf ~/.codex/packages/standalone ~/.codex/packages/app-server-daemon # the CLI's package and the server's
rm -rf ~/.codex/app-server-daemon # the server's settings, pid files and lock
如果安裝時 ~/.local/bin 不在你的 PATH 上,或安裝程式發現了互相競爭的 Homebrew、npm 或 bun 安裝並改寫了那個項目,指令碼還會在你的 shell profile 附加一個有標記的區塊:~/.zprofile(macOS zsh)、~/.bash_profile(macOS bash)、~/.zshrc(Linux zsh)、~/.bashrc(Linux bash)或 ~/.profile(其他 shell)裡從 # >>> Codex installer >>> 到 # <<< Codex installer <<<。刪掉那三行就完成了。12
在 Windows 上,install.ps1 在 %USERPROFILE%\.codex\packages\standalone(若你設了那個變數則是 %CODEX_HOME%\packages\standalone)底下維持同樣的配置:下載的版本放在 releases\,一個 current junction 指向使用中的版本。它透過 %LOCALAPPDATA%\Programs\OpenAI\Codex\bin(可用 CODEX_INSTALL_DIR 覆寫)暴露 codex.exe,那本身又是指向 current\bin 的 junction;而且它不用 profile 區塊,而是把那個 bin 路徑寫進你的使用者 PATH,供之後的 PowerShell 工作階段使用。背景伺服器在那裡也有同樣的兩個資料夾:packages\app-server-daemon 與 app-server-daemon。1720 停止它,移除 standalone 目錄與伺服器的兩個資料夾,再移除此時已懸空的 bin junction,最後到「環境變數」把該項目從使用者 Path 變數裡拿掉:17
codex app-server daemon stop # the background server; its updater is a separate process
Get-Process codex* -ErrorAction SilentlyContinue # what is still running
Get-ChildItem "$env:USERPROFILE\.codex\app-server-daemon\*.pid" -ErrorAction SilentlyContinue | ForEach-Object { "$($_.Name): $(Get-Content $_)" } # the recorded pids, by file
這裡同樣由 pid 檔案來判斷:如果 %USERPROFILE%\.codex\app-server-daemon\daemon.pid 或 daemon-updater.pid(對 standalone 套件上的伺服器而言是 app-server.pid 與 app-server-updater.pid)裡記錄的行程仍然存活,現在就用 Stop-Process -Id <pid> 結束它;其他任何 Codex 行程都是你正在執行的別的東西。接著移除其餘部分:20
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\packages\standalone" # releases plus the current junction
Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\packages\app-server-daemon", "$env:USERPROFILE\.codex\app-server-daemon" -ErrorAction SilentlyContinue # the server's package and state
cmd /c rmdir "$env:LOCALAPPDATA\Programs\OpenAI\Codex\bin" # the bin junction; rmdir removes the link, not a target
codex sandbox uninstall(v0.162.0)是針對舊有 Windows 沙箱的另一項清理:它以管理員權限移除整台機器範圍的沙箱帳戶與網路規則,不動 Codex 主目錄與沙箱目錄,在其他平台上會被拒絕。19
無論走哪條路徑,如果背景伺服器正在執行,都請先停止它(codex app-server daemon stop),並查看是否存在 ~/.codex/packages/app-server-daemon:常駐程式的 README 說,沒有常駐程式套件時,bootstrap 會把呼叫它的那個套件複製到該資料夾,而單獨的可執行檔無法提供這樣的套件;至於 Homebrew 或 npm 安裝的自動啟動是否會建立它,這裡沒有測試過;如果該資料夾存在,請在套件管理器移除之後,把它和 ~/.codex/app-server-daemon 一起刪除。20 上面的套件管理器移除都不會碰 ~/.codex/。Homebrew 的 --zap 實際上也不會:cask 唯一的 zap 段落是 rmdir: "~/.codex",而 Homebrew 只對已經是空的目錄套用 rmdir:。2 那個目錄存放 config.toml、你儲存的憑證與每一個工作階段,這就是為什麼重新安裝後登入與歷史紀錄會接著上次繼續。只有在你真的想要一個乾淨的起點時才刪除它,並且要知道這在指令碼安裝上意味著什麼:
rm -rf ~/.codex # discards config.toml, credentials, all sessions -- AND the CLI itself on a script install
保留狀態的乾淨重裝在 npm 上只要一行:npm uninstall -g @openai/codex && npm install -g @openai/codex@latest。在指令碼路徑上,重新執行安裝程式會在 ~/.codex/packages/standalone/releases 底下加入新版本,把 current 重新指向它,舊版本則原樣保留到你自己移除為止,你的設定也保持不動。12
一張表看完整個生命週期
| 工作 | install.sh (macOS, Linux) | install.ps1 (Windows) | npm | Homebrew | winget |
|---|---|---|---|---|---|
| 安裝 | curl -fsSL https://chatgpt.com/codex/install.sh \| sh |
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 \| iex" |
npm install -g @openai/codex |
brew install --cask codex |
winget install OpenAI.Codex |
| 更新 | codex update,或重新執行指令碼 |
codex update,或重新執行指令碼 |
codex update,或 npm install -g @openai/codex@latest |
codex update,或 brew upgrade --cask codex |
winget upgrade OpenAI.Codex(codex update 不辨識這條路徑) |
| 鎖定版本 | sh -s -- --release 0.162.1 |
安裝那一行之前先 $env:CODEX_RELEASE = '0.162.1' |
npm install -g @openai/[email protected] |
不支援 | winget install OpenAI.Codex --version 0.161.0 |
| 移除 | 先 codex app-server daemon stop,再移除 ~/.local/bin 的符號連結、~/.codex/packages/standalone、~/.codex/packages/app-server-daemon 與 ~/.codex/app-server-daemon |
先 codex app-server daemon stop,再移除 %USERPROFILE%\.codex\packages\standalone、伺服器的 packages\app-server-daemon 與 app-server-daemon 資料夾、%LOCALAPPDATA%\Programs\OpenAI\Codex\bin junction,以及使用者 PATH 項目 |
若有伺服器在執行,先 codex app-server daemon stop,再 npm uninstall -g @openai/codex,常駐程式資料夾若存在也一併移除 |
同樣先停止,再 brew uninstall --cask codex(--zap 不會清掉非空的 ~/.codex),常駐程式資料夾若存在也一併移除 |
同樣先停止,再 winget uninstall OpenAI.Codex,常駐程式資料夾若存在也一併移除 |
| 檢查 | codex --version、codex doctor |
同上 | 同上 | 同上 | 同上 |
codex doctor 檢查什麼?
codex doctor 是回報 bug 或除錯一個「昨天還好好的」安裝之前該執行的命令。在 0.153.4 上,它把七個區段收進一份報告:Notes、Environment(執行環境與安裝一致性)、Configuration(config.toml 載入狀態、驗證、MCP、沙箱原則)、Desktop App(v0.149.0 新增)、Updates、Connectivity 與 Background Server。--summary 給精簡檢視,--json 給去敏感化的機器可讀格式,--all 展開被截斷的清單,--no-color 用於日誌;0.153.4 的 codex doctor --help 也列出 --ascii;v0.162.0 在報告中加入了所設定的 TUI 模式。7131522 大多數「Codex 壞了」的回報都能歸結為它第一個畫面上點名的某件事:過期的驗證模式、一個解析失敗的 config.toml,或一份遮住你 PATH 上那份的第二安裝。逐區段的完整說明在指南裡。
安裝之後會變的事
全新安裝第一個絆到的不是二進位檔。從 v0.149.0 起,CLI 遇到 approval_policy = "untrusted" 會拒絕啟動,所以從舊機器複製過來的 config.toml 需要改一處。13 從 Claude Code 過來的?遷移文章把兩邊的設定並排對照,hooks 文章則說明 Codex 在模型周圍執行些什麼。Codex CLI 指南是完整參考:沙箱與核准模式、AGENTS.md、MCP、skills 與雲端任務。如果你兩個工具都用,Claude Code 安裝頁是本頁的孿生篇。
常見問題
如何把 Codex CLI 更新到最新版本?
執行 codex update(v0.128.0 起);它會偵測你是透過指令碼、npm 還是 Homebrew 安裝,並執行該通道的升級。手動對應做法是重新執行安裝指令碼、npm install -g @openai/codex@latest,或 brew upgrade --cask codex。winget 安裝不是 codex update 辨識的通道;那一種請用 winget upgrade OpenAI.Codex。
Codex CLI 會自動更新嗎?
CLI 不會,但有一個例外。TUI 會檢查是否有新版本,並提供符合你安裝通道的更新命令,而 codex update(v0.128.0 起)負責執行它。例外是 Codex 從 v0.157.0 起預設啟動的背景伺服器:在 latest 通道上,它會在啟動 5 分鐘後檢查更新,之後每小時一次;而最初從較舊指令碼安裝啟動的伺服器,一旦某次 latest 安裝記錄了通道,就會更新 CLI 本身的套件 ~/.codex/packages/standalone。要停止這件事,請在 ~/.codex/app-server-daemon/settings.json 裡設定 "updater": { "autoUpdateEnabled": false },然後執行 codex app-server daemon restart。
如何移除 Codex CLI?
如果背景伺服器正在執行,先停止它(codex app-server daemon stop),再用安裝它的那條路徑:npm uninstall -g @openai/codex、brew uninstall --cask codex,或 winget uninstall OpenAI.Codex,並查看 ~/.codex/packages/app-server-daemon 與 ~/.codex/app-server-daemon,套件管理器移除會把它們留下。指令碼安裝的話,同樣先停止,再移除 ~/.local/bin/codex 符號連結(macOS 上還有 ~/.local/bin/codex-code-mode-host)、~/.codex/packages/standalone 目錄,以及伺服器的 ~/.codex/packages/app-server-daemon 與 ~/.codex/app-server-daemon。在 Windows 上,指令碼安裝是 %USERPROFILE%\.codex\packages\standalone(外加伺服器的 packages\app-server-daemon 與 app-server-daemon 資料夾)、%LOCALAPPDATA%\Programs\OpenAI\Codex\bin junction,以及你使用者 PATH 裡的一個項目;全部都要移除。你的設定、憑證與工作階段會留在 ~/.codex/,直到你自己把那個目錄的其餘部分刪掉。
如何在 Windows 上安裝 Codex CLI?
執行 powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"。CLI 以原生方式在 PowerShell 裡搭配 Windows 沙箱執行(設定了 prefer_mxc = true 且裝置支援時使用 Microsoft Execution Containers,否則使用你設定的舊有模式,未設定時為 elevated;明確選擇 [windows] sandbox = "mxc" 則要麼使用 MXC,要麼失敗,沒有備援);WSL2 是在你需要 Linux 工具或所有沙箱實作都不合用時的選項,不是必要條件。Windows 11 是建議的基準。winget install OpenAI.Codex 也能用,但落後穩定線。
安裝 Codex 需要 Node.js 嗎?
只有 npm 路徑需要,而且套件要求 Node 16 或更新版本。安裝指令碼、PowerShell 指令碼與 Homebrew cask 都提供編譯好的 codex 二進位檔,所以沒有 Node 的機器也能執行 Codex。
如何查看我裝的是哪個版本的 Codex?
codex --version 會印出來(例如 codex-cli 0.163.0)。npm view @openai/codex version 顯示最新發布的版本,codex doctor 則回報安裝路徑,以及 PATH 上是否有另一份副本遮住了它。
-
OpenAI,openai/codex README——安裝一節以 macOS 與 Linux 的
curl -fsSL https://chatgpt.com/codex/install.sh | sh和 Windows 的 PowerShellinstall.ps1單行命令領頭,接著說 CLI「can also be installed via」npm(npm install -g @openai/codex)與 Homebrew(brew install --cask codex);文件化了curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_INSTALLER_USE_RELEASES_OPENAI_COM=false sh與 PowerShell 形式$env:CODEX_INSTALLER_USE_RELEASES_OPENAI_COM='false',引言為「To force GitHub Releases, setCODEX_INSTALLER_USE_RELEASES_OPENAI_COMtofalse(0andnoare also accepted)」;@openai/codex套件名稱;GitHub Releases 上 macOS(Apple silicon、x86_64)與 Linux(x86_64、arm64)的平台二進位檔。2026-09-06 查證,2026-10-15 再次查證,當時安裝一節除註 6 所引的那句之外沒有變化。 ↩↩↩↩↩↩↩↩↩ -
Homebrew,cask
codex——cask tokencodex、單一當前版本(2026-10-15 為 0.163.0,由 Homebrew/homebrew-cask 的codex 0.163.0commit 於 21:44:02 UTC 更新,也就是 21:30:38 UTC 的 GitHub release 之後 13 分鐘)、一個bin/codex二進位產物及由它產生的 shell 補全、空的depends_on、除 macOS 各版本之外還包括x86_64_linux與arm64_linux的受支援平台,以及指向 GitHub release 上codex-package-aarch64-apple-darwin.tar.gz的下載 URL。2026-10-15 透過 formulae API 與 homebrew-cask 的 commit 清單查證(2026-09-06 為 0.153.4)。cask 的 zap 段落是zap rmdir: "~/.codex",而 Cask Cookbook 把rmdir:定義為「若為空則移除」的目錄路徑。 ↩↩↩↩↩↩ -
Microsoft,
OpenAI.Codex的 winget-pkgs manifest——2026-10-15 有 138 個已發布版本,最新為 0.161.0(2026-09-06 為 119 個、0.146.1);沒有 0.147.0、0.152.1 以及 0.153.x 到 0.155.x 的 manifest。套件由 OpenAI 發布:openai/codex 的.github/workflows/rust-release.yml有一個winget工作,用komac提交 manifest(其註解:「Adapted from the WinGet Releaser version previously used by this job」;2026-10-15 重新讀取)。以下 pull request 取自 2026-10-15 對該儲存庫的搜尋,日期為 UTC,除另行註明外皆由oai-fork-bot開出:0.147.0(#413497)未合併即關閉;0.148.0(#420225)到 0.152.0(#427090)於 8 月 18 日到 9 月 1 日開啟,9 月 11 日合併,但 0.151.0(#426091)在 9 月 30 日、0.149.1(#423060)在 10 月 1 日合併;0.154.0(#435129,由社群成員z3oya開出)未合併即關閉;0.156.0(#439266)到 0.161.0(#448267)共 12 個請求,於 9 月 22 日到 10 月 7 日開啟,每個都在開啟當天或隔天合併;0.162.0(#449062)、0.162.1(#449772)與 0.163.0(#453561)在 2026-10-15 仍開著。OpenAI 的 README 與 CLI 文件都沒有提到 winget。 ↩↩↩↩↩ -
OpenAI,Codex CLI v0.128.0 版本說明,2026 年 4 月 30 日——「Added
codex update, configurable TUI keymaps, plan-mode nudges, action-required terminal titles, and active-turn/statuslineand/titleedits.」該命令的 pull request openai/codex #19933(2026 年 4 月 28 日合併)寫道「Reused the existing install-channel detection and update command runner that the TUI already uses for update prompts.」通道對照在codex-rs/tui/src/update_action.rs:npm 及其 bun、pnpm 與 Vite+ 同類、Homebrew,以及獨立安裝程式(Unix 與 Windows);沒有 winget 變體(2026-09-06 讀取)。2026-10-15 重新讀取:該 enum 新增了Daemon(DaemonUpdateSource)(「Replace the local daemon after restoring the terminal」),獨立安裝的命令變為curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh與$env:CODEX_NON_INTERACTIVE=1; irm https://chatgpt.com/codex/install.ps1 | iex;仍然沒有 winget 變體。 ↩↩↩↩ -
OpenAI,Codex CLI v0.106.0 版本說明,2026 年 2 月 26 日——「Added a direct install script for macOS and Linux and publish it as a GitHub release asset, using the existing platform payload (including
codexandrg)」;此後每個 release 都附有install.sh。rust-v0.163.0 release(資產於 2026-10-15 透過 GitHub releases API 列出)包含install.sh與install.ps1、各平台的codex-<target>.tar.gz、.zst與 macOS.dmg檔案、附帶codex-package_SHA256SUMS的codex-package-<target>.tar.gz套件包、codex-app-server-*與codex-responses-api-proxy-*二進位檔、codex-npm-*.tgztarball,以及 6 個openai_codex_cli_bin-0.163.0-*.whl檔案;PyPI 把openai-codex-cli-bin描述為「Pinned Codex CLI runtime for the Python SDK」。2026-10-15 下載的 macOS arm64 tarball 只含一個項目codex-aarch64-apple-darwin。 ↩↩ -
OpenAI,Codex CLI v0.146.0 版本說明,2026 年 7 月 29 日——「Publish release artifacts, channel metadata, and installer aliases through OpenAI-hosted release infrastructure, with GitHub fallback.」
https://chatgpt.com/codex/install.sh以 302 回應到https://releases.openai.com/codex/install.sh(2026-09-06 與 2026-10-15 檢查);2026-10-15 的 README 寫道:「The standalone installers download fromhttps://releases.openai.com/codexby default and fall back to GitHub Releases if a metadata or asset download is unavailable.」 ↩ -
OpenAI,
feat(cli): add codex doctor diagnostics,openai/codex PR #22336,2026 年 5 月 13 日合併——報告的各區段(Notes、Environment、Configuration、Updates、Connectivity、Background Server)及其--summary、--json、--all與--no-color旗標。 ↩↩ -
OpenAI,Windows 上的 Codex:Windows 沙箱——2026-10-15 讀取時:Microsoft Execution Containers,「which Microsoft is rolling out to Windows 11 devices. Microsoft introduced MXC process isolation in Windows 11 24H2 (build 26100.9278) and 25H2 (build 26200.9278)」;「The desktop app automatically prefers MXC for consumer accounts when the device supports it」,CLI 則用
[features]底下的prefer_mxc = true;requirements.toml中[windows]底下的allow_mxc = false會封鎖它;為「Codex CLI 0.162.0 and later」記載的一條命令的測試,預期輸出MXC_OK;舊有備援[windows] sandbox = "elevated"(「the preferred legacy fallback」)與"unelevated"(「a legacy fallback」,帶有「weaker network isolation than elevated」);「Use MXC when the device and policy support it. Otherwise, prefer elevated, with unelevated as a secondary fallback」;「Use the native Windows sandbox by default. Choose WSL when you need Linux-native tooling, your workflow already lives in WSL2, or the available native Windows implementations don’t meet your needs」;建議 Windows 11,「Recent, fully updated Windows 10」標示為「Best effort」,主控台支援方面寫明「Windows 10 version 1809 or newer is required」,更舊的 Windows 10 不建議;設定時預期winget可用。首次查證於 2026-09-06,當時該頁只描述了兩種舊有模式。 ↩↩↩↩↩↩↩↩ -
OpenAI,openai/codex releases——
rust-v0.163.0於 2026 年 10 月 15 日 21:30 UTC 作為最新版發布,此前依序是rust-v0.160.0(10 月 1 日)、rust-v0.160.1(10 月 5 日)、rust-v0.161.0(10 月 7 日)、rust-v0.162.0(10 月 8 日)與rust-v0.162.1(10 月 9 日);2026 年 9 月 4 日的最新版是rust-v0.153.4(根據 9 月 6 日的讀取;10 月 15 日的清單只回溯到 10 月 1 日)。日期取自 GitHub releases API。 ↩↩↩ -
npm,
@openai/codex——latest= 0.163.0(2026-10-15 21:37 UTC 發布),alpha= 0.163.0-alpha.11(2026-10-14 03:38 UTC 發布),0.163.0 上的engines: { node: ">=16" },皆取自 2026-10-15 的 registry 文件;2026-09-06 的latest是 0.153.4,文件的time對照在 0.146.1 之後到 0.153.4 為止列出 14 個穩定版本(0.147.0、0.148.0、0.149.0、0.149.1、0.150.0、0.150.1、0.151.0、0.152.0、0.152.1、0.153.0 到 0.153.4)。 ↩↩↩↩↩↩ -
OpenAI,Codex CLI 文件——安裝以獨立安裝程式領頭(macOS 與 Linux 的
curl -fsSL https://chatgpt.com/codex/install.sh | sh,以及一個 Windows 安裝程式分頁),把 Homebrew 與 npm 列為替代方案,並以重新執行安裝程式作為獨立安裝的更新方式。2026-09-06 查證,2026-10-15 再次查證,當時的安裝分頁是 macOS/Linux、Windows、npm 與 Homebrew。 ↩↩↩↩↩↩ -
OpenAI,2026-09-06 提供、2026-10-15 重新讀取的
install.sh安裝指令碼——Usage: install.sh [--release VERSION];環境變數CODEX_RELEASE(「Version to install; overridden by –release」)、CODEX_INSTALL_DIR(預設~/.local/bin)、CODEX_HOME(預設~/.codex)與CODEX_INSTALLER_USE_RELEASES_OPENAI_COM(「Set to 0, false, or no to use GitHub Releases」);版本存放在current符號連結之後的~/.codex/packages/standalone/releases,bin 目錄裡有codex符號連結(macOS 上還有codex-code-mode-host);當 bin 目錄不在PATH上或偵測到互相競爭的受管安裝時,會在~/.zprofile、~/.bash_profile、~/.zshrc、~/.bashrc或~/.profile附加# >>> Codex installer >>>/# <<< Codex installer <<<的PATH區塊(add_to_path只在沒有衝突時才於PATH相符時提前返回);以及會警告「Multiple managed Codex installs can be ambiguous because PATH order decides which one runs」並提議brew uninstall --cask codex、npm uninstall -g @openai/codex或bun remove -g @openai/codex的衝突安裝檢查。2026-10-15 的版本在用法說明裡加入了CODEX_NON_INTERACTIVE(「Set to 1, true, or yes to skip prompts」);新增僅限常駐程式的模式(CODEX_INSTALL_DAEMON_ONLY=1,根目錄~/.codex/packages/app-server-daemon,更新程式記錄app-server-daemon/daemon-updater.pid,標記檔案auto-update-version,在指令碼結尾為latest安裝寫入、為明確指定的版本刪除),並在所選版本不是已記錄版本時退出的防護上附有註解「An explicit daemon update may leave a local or pinned release. Scheduled updates still require the selected release to follow the latest channel.」;並優先使用經codex-package_SHA256SUMS驗證的codex-package-<target>.tar.gz資產,把平台 npm tarball 作為舊有配置。套件包內的bin/codex、bin/codex-code-mode-host與codex-path/rg會被設為可執行,codex-code-mode-host連結只在 macOS 上建立;更新程式以子命令app-server daemon pid-update-loop執行(指令碼第 1266 行的擁有權檢查以--check-package-ownership呼叫它)。 ↩↩↩↩↩↩↩↩↩↩↩↩↩↩ -
OpenAI,Codex CLI v0.149.0 版本說明,2026 年 8 月 20 日——包含 #39630「Retire the untrusted approval policy」,以及「
codex doctornow diagnoses endpoint protection, network/proxy failures, desktop app state, and update connectivity.」 ↩↩ -
OpenAI,Windows 上的 Codex:WSL,2026-10-15 重新查證——「Use Codex CLI with WSL」:
wsl --install,開啟 WSL shell,然後curl -fsSL https://chatgpt.com/codex/install.sh | sh與codex;該頁也建議把儲存庫放在 Linux 家目錄底下,而不是掛載自 Windows 的/mnt/c/路徑,以獲得較快的 I/O。 ↩ -
作者於 2026-09-06 在 Codex CLI 0.153.4(npm 安裝)上重現:
codex doctor --summary --no-color依序印出 Notes、Environment、Configuration、Desktop App、Updates、Connectivity 與 Background Server 各區段;codex doctor --help列出--ascii。 ↩ -
OpenAI,Codex 設定參考——
check_for_update_on_startup(boolean):「Check for Codex updates on startup (set to false only when updates are centrally managed)」;features.in_app_updates(boolean):「Set to false in requirements.toml to disable in-app updates. Updates remain enabled by default when this requirement is omitted.」2026-09-06 與 2026-10-15 查證。 ↩ -
OpenAI,2026-09-06 提供、2026-10-15 重新讀取的
install.ps1安裝指令碼——參數區塊param([string]$Release = $env:CODEX_RELEASE),備援為latest;$codexHome=CODEX_HOME或%USERPROFILE%\.codex;packages\standalone內有releases\、一個currentjunction 與install.lock;可見的 bin 目錄%LOCALAPPDATA%\Programs\OpenAI\Codex\bin(或CODEX_INSTALL_DIR)建立為指向current\bin的 junction;使用者範圍的Path以[Environment]::SetEnvironmentVariable("Path", ..., "User")寫入(「PATH updated for future PowerShell sessions.」)。2026-10-15 的版本用 .NET(SHA256CryptoServiceProvider)計算壓縮檔的 SHA-256,並與該版本的codex-package_SHA256SUMS比對,不相符時拋出「Downloaded Codex archive checksum did not match expected digest」。 ↩↩↩↩ -
OpenAI,Codex CLI v0.162.0 版本說明,2026 年 10 月 8 日——「Publish a signed PowerShell installer with Windows releases. (#51158)」與「Fix archive checksum verification when installing through Windows PowerShell with PowerShell 7 module paths present. (#51257)」。PR #51158,2026 年 10 月 5 日合併:「sign
scripts/install/install.ps1with Azure Trusted Signing in the x64 release job」與「publish the signed artifact asinstall.ps1instead of copying the unsigned source」。PR #51257,10 月 6 日合併:「compute SHA-256 directly with .NET APIs after resolving the archive path」。 ↩ -
OpenAI,
Add a CLI command to uninstall the legacy Windows sandbox,openai/codex PR #50437,2026 年 10 月 2 日合併,並列入 v0.162.0 版本說明;該 pull request 的描述:「Addcodex sandbox uninstallto remove machine-wide legacy Windows sandbox accounts and network rules with administrator privileges. Run cleanup without loading configuration, preserving Codex home, sandbox directories, and filesystem permissions. Reject the command on other platforms.」 ↩ -
OpenAI,標籤 rust-v0.163.0 上的
codex-rs/app-server-daemon/README.md——「codex-app-server-daemonis experimental and its lifecycle contract may change」;八條命令(codex app-server daemon start、restart、update、enable-remote-control、disable-remote-control、stop、version、bootstrap --remote-control);「Eligible managed daemons check for updates after five minutes, then hourly by default. EditCODEX_HOME/app-server-daemon/settings.jsonto change this」及範例"updater": { "autoUpdateEnabled": false, "updateIntervalMinutes": 120 };「It launches a detached updater loop when automatic updates are enabled, the installer selected the stablelatestchannel, and the managed binary supports the updater command」;「New daemons useCODEX_HOME/packages/app-server-daemon/current/bin/codex」與「Daemon-only installer updates leave the user’s CLI command and shell setup alone」;「Previously launched legacy daemons retainCODEX_HOME/packages/standalone/current, including its flat binary layout when present. Starts and scheduled updates keep using that location」;情境表(安裝程式選擇明確版本時的「the selected release stays pinned」;「the running server restarts with the new binary before the updater replaces itself」);README 所列CODEX_HOME/app-server-daemon/底下的狀態檔案(settings.json、app-server.pid、app-server-updater.pid、daemon.lock;專用常駐程式的daemon.pid與daemon-updater.pid取自下方的原始碼);「stopsends a graceful termination request first, then force-terminates the process after the configured grace window if it is still alive」;「installs made before the installer recorded channel selections need one newlatestinstallation to opt into automatic updates; until then the daemon continues to serve app-server without updating the selected release」;「daemon updateselects the latest stable release, even with automatic updates disabled. It also returns pinned or local managed packages to production update eligibility」、「A running daemon restarts, so active or queued work may be interrupted」與「Legacy installations migrate to the dedicated root once the published installer and release support migration」;「bootstrapcan use any complete CLI package. If no daemon package is installed, it copies the invoking package intoCODEX_HOME/packages/app-server-daemon」與「A bare executable cannot supply a new installation」。pid 檔名取自同一標籤的原始碼codex-rs/app-server-daemon/src/lib.rs:LEGACY_PID_FILE_NAME = "app-server.pid"、LEGACY_UPDATE_PID_FILE_NAME = "app-server-updater.pid"、DAEMON_PID_FILE_NAME = "daemon.pid"、DAEMON_UPDATE_PID_FILE_NAME = "daemon-updater.pid"(第 54 到 57 行),舊有的那一對只在受管理的二進位檔位於packages/standalone底下時選用(第 334 到 337 行與第 376 到 379 行),stop停止執行中的後端(第 615 行),而更新程式由ensure_managed_updater在啟動、重新啟動或遠端控制變更時停止(第 893 到 930 行),另有兩條生命週期路徑也會停止它(第 474 到 477 行與第 829 到 832 行),stop從不停止它;README 的「the updater loop is not reboot-persistent」(第 145 行);命令列取自src/backend/pid.rs(第 385 到 401 行:伺服器為app-server --listen unix://,開啟遠端控制時為app-server --remote-control --listen unix://,更新程式為app-server daemon pid-update-loop)。另見 OpenAI,Codex CLI v0.157.0 版本說明,2026 年 9 月 25 日 02:31 UTC 發布——「Enabled automatic background-server startup for eligible interactive sessions, with recovery choices when server settings are incompatible. (#47179, #47318)」;v0.162.0——「#50499 Include installer stderr in daemon update failures」,其 pull request 開頭寫著「Daemon updates discard installer stderr」;v0.163.0,10 月 15 日——「Restart a managed background server from/daemon. Codex warns about work the restart could interrupt, then reconnects automatically. (#53173)」與「#52223 Enforce application network policy for daemon updates」。安裝程式的常駐程式模式及其更新防護見註 12。 ↩↩↩↩↩↩↩↩ -
OpenAI,Codex CLI v0.161.0 版本說明,2026 年 10 月 7 日——「Publishing an older alpha or hotfix no longer moves npm alpha tags backward. (#49704)」。 ↩
-
OpenAI,Codex CLI v0.162.0 版本說明——「#50200 Report the configured TUI mode in
codex doctor」。 ↩