Skip to main content
This example installs a pinned Codex CLI release inside a Node.js microVM and opens it in a project mounted from your host. Codex can work directly in the checkout, while its executable, authentication, configuration, and sessions stay inside the sandbox.

Run Codex CLI

1

Start Codex

Replace ./my-project with the project directory you want Codex to work on:
On first launch, choose Sign in with ChatGPT, Sign in with Device Code, or provide an API key. Browser-based sign-in happens on your host while the resulting Codex credentials are stored on the sandbox’s root disk.
For an isolated workspace, or when using microsandbox cloud, replace --mount-dir ./my-project:/workspace:rw with --copy-dir ./my-project:/workspace.
2

Start another session

After leaving Codex, return to the same sandbox and workspace with:
The sandbox root disk retains the files under /root/.codex, including authentication, configuration, and session history.
3

Verify the installation

Exit the TUI and run:
The pinned example prints codex-cli 0.148.0.
4

Review or export changes

With the default writable mount, changes are already in the host checkout. Review them inside the sandbox:
If you chose the isolated --copy-dir alternative, create a patch inside the sandbox:
Copy the patch to the host:
Check that it applies cleanly before applying it:
5

Clean up

Remove the sandbox:
Removing the sandbox also removes its Codex credentials, configuration, and sessions. Changes made through the default workspace mount remain in the host checkout.

Reference