讓 Codex 操作電腦
說明 Computer Use 如何讓 Codex 操作本地 Mac app,並處理必須透過 GUI 完成的任務。
在 Codex App 中,Computer Use 讓 Codex 透過圖形介面操作本地 app。平臺支援、地區可用性和外掛入口屬於高波動資訊,使用前以官方 App 文件和當前 App 設定為準。
Computer Use 等於把螢幕內容、點選、鍵盤輸入和部分系統狀態交給 Codex 處理。只給明確目標 app 或 flow 授權,不要把它當成通用後臺自動化許可權。
使用前需要安裝 Computer Use plugin,並在 macOS 提示時授予:
- Screen Recording
- Accessibility
有了 computer use,Codex 可以在 macOS 上看見並操作 graphical user interfaces。它適合 command-line tools 或 structured integrations 不夠用的任務,例如檢查 desktop app、使用 browser、修改 app settings、處理沒有 plugin 的 data source,或復現只發生在 GUI 中的 bug。
由於 computer use 可能影響 project workspace 外的 app 和 system state,任務要保持清晰邊界,並在繼續前 review permission prompts。
Set up computer use
設定步驟:
- 在 Codex settings 中開啟 Computer Use。
- 點選 Install 安裝 Computer Use plugin。
- 當 macOS 請求 access 時,如果你希望 Codex 看見並操作目標 app,授予 Screen Recording 和 Accessibility permissions。
許可權含義:
| Permission | 用途 |
|---|---|
| Screen Recording | 讓 Codex 看見 target app。 |
| Accessibility | 讓 Codex click、type 和 navigate。 |
When to use computer use
當任務依賴 graphical user interface,並且僅靠 files 或 command output 很難驗證時,選擇 computer use。
適合場景:
- 測試 macOS app、iOS simulator flow,或 Codex 正在構建的其他 desktop app。
- 執行需要 web browser 的任務。
- 復現只出現在 graphical interface 中的 bug。
- 修改必須點選 UI 才能完成的 app settings。
- 檢查 app 或 data source 中的資訊,而這些資訊沒有 plugin 可用。
- 讓一個 scoped task 在後臺執行,你繼續處理其他工作。
- 執行跨多個 apps 的 workflow。
如果你構建的是本地 web app,優先使用 in-app browser。
Start a computer use task
在 prompt 中提到 @Computer Use 或 @AppName,也可以直接要求 Codex 使用 computer use。你需要描述 Codex 應該操作的具體 app、window 或 flow。
Open the app with computer use, reproduce the onboarding bug, and fix the
smallest code path that causes it. After each change, run the same UI flow
again.Open @Chrome and verify the checkout page still works after the latest changes.如果 target app 已經有 dedicated plugin 或 MCP server,優先使用這種 structured integration 來訪問資料和執行可重複操作。只有當 Codex 需要視覺檢查或直接操作 app 時,再選擇 computer use。
Permissions and approvals
macOS system permissions 和 Codex app approvals 是兩套機制。
| 機制 | 控制內容 |
|---|---|
| macOS system permissions | 允許 Codex 看見並操作 apps。 |
| Codex app approvals | 決定你允許 Codex 使用哪些 apps。 |
| Thread sandbox / approvals | file reads、file edits 和 shell commands 仍然遵循 thread 的 sandbox 與 approval settings。 |
使用 computer use 時,Codex 只能看見並操作你允許的 apps。任務期間,Codex 在使用某個 app 前會向你請求 permission。你可以選擇 Always allow,讓 Codex 後續無需再次詢問即可使用這個 app。
要移除已允許的 apps,進入 Codex settings 的 Computer Use section,從 Always allow list 中刪除。
官方截圖:
- light:https://developers.openai.com/images/codex/app/computer-use-approval-light.webp
- dark:https://developers.openai.com/images/codex/app/computer-use-approval-dark.webp
Codex 在執行 sensitive 或 disruptive actions 前,也可能再次請求 permission。
如果 Codex 看不見或無法控制某個 app,開啟 macOS:
System Settings > Privacy & Security檢查 Codex App 的 Screen Recording 和 Accessibility permissions。
Safety guidance
使用 computer use 時,Codex 可以檢視 screen content、截圖,並和 target app 中的 windows、menus、keyboard input、clipboard state 互動。
把這些內容都當作 Codex 任務期間可能處理的 context:
- visible app content
- browser pages
- screenshots
- target app 中開啟的 files
安全使用建議:
- 每次只給 Codex 一個明確 target app 或 flow。
- 你可以隨時停止任務,或接管電腦。
- 不需要的 sensitive apps 保持關閉。
- 避免讓任務依賴 secrets;如果確實需要,你要在場並逐步 approve。
- allow Codex 使用 app 前,先 review app permission prompts。
- Always allow 只用於你信任 Codex 未來自動使用的 apps。
- account、security、privacy、network、payment 或 credential-related settings 相關操作,你要保持在場。
- 如果 Codex 開始操作錯誤 window,取消任務。
如果 Codex 使用你的 browser,它可以操作你已經登入的 pages。review website actions 時,把它當作你本人正在操作:web pages 可能包含惡意或誤導內容,網站也可能把你 approve 的 clicks、form submissions 和 signed-in actions 當成來自你的賬號。你希望自己繼續使用 browser 時,讓 Codex 使用另一個 browser。
該功能不能 automate terminal apps 或 Codex itself,因為這可能繞過 Codex security policies。它也不能以 administrator 身份認證,不能替你批准電腦上的 security 和 privacy permission prompts。
File edits 和 shell commands 在適用時仍然遵循 Codex approval 與 sandbox settings。透過 desktop apps 做出的 changes,只有在儲存到磁碟並被 project 跟蹤後,才可能出現在 review pane 中。
你的 ChatGPT data controls 適用於透過 Codex 處理的內容,包括 computer use 擷取的 screenshots。