Cannot install Codex CLI on a remote computer

Resolved 💬 4 comments Opened Sep 16, 2025 by theklen-ai Closed Nov 2, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

_No response_

Which model were you using?

_No response_

What platform is your computer?

_No response_

What steps can reproduce the bug?

Hmmm… can't reach this page
localhost refused to connect.

CLI is running on a remote computer, not localhost. Why not to copy-paste a key after authentication as in Claude Code?

What is the expected behavior?

_No response_

What do you see instead?

_No response_

Additional information

_No response_

View original on GitHub ↗

4 Comments

nasa1024 · 11 months ago

hi, there.
you need run this command to solve it
ssh -N -L 1455:127.0.0.1:1455 user@23.54.1.111 (your server ip)
Open a forwarding proxy request

ben-vargas · 11 months ago

You can also copy the auth.json contents from a working machine to the headless machine, or you can copy the OAuth workflow URL and complete it on a machine with browser... then when you get the failed redirect to localhost copy that url and open another terminal session to the headless machine and use curl '<url>' to send the response back to codex cli on the headless machine. Make sure you use the ' around the URL - and sometimes you need to send it twice and it will display an error the second time, but auth.json is created and functions in my experience.

watate · 10 months ago

Having the same issue here. I think the flow currently is a bit complicated compared to Claude Code or Amp Code

etraut-openai contributor · 9 months ago

This is being tracked in this issue. Closing this one to reduce duplication.