Allow sign in via link instead of trying to use XDG to open a system browser

Resolved 💬 3 comments Opened May 17, 2025 by bossdown123 Closed Aug 7, 2025
Sign in with ChatGPT to generate an API key or paste one you already have.
[use arrows to move, enter to select]

❯ Sign in with ChatGPT
  Paste an API key (or set as OPENAI_API_KEY)

(  ●   ) Waiting for authentication… ctrl + c to quit
node:events:485
      throw er; // Unhandled 'error' event
      ^

Error: spawn xdg-open ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn xdg-open',
  path: 'xdg-open',
  spawnargs: [
    ''
  ]
}```

should have an option to just click a link instead

View original on GitHub ↗

3 Comments

rgov · 1 year ago

I encountered this limitation while using Codex in a devcontainer without xdg-utils installed. But VS Code provides a helper to open the host system's browser, which you can hook up like so:

"postCreateCommand": {
    "xdg-open": "(echo '#!/bin/bash -eu'; echo 'exec \"$BROWSER\" \"$@\"') > /usr/local/bin/xdg-open; chmod +x /usr/local/bin/xdg-open"
},
bossdown123 · 1 year ago

thanks this works

codex-maintainers · 1 year ago

Thank you for the feedback! Please try the latest version of Codex CLI to see if the issue persists. If it does, we'd appreciate a report or a PR to the codex-rs/ implementation. More details on our project update can be found here.