Logging in with ChatGPT failing
What version of Codex is running?
codex-cli 0.16.0
Which model were you using?
No response
What platform is your computer?
Darwin 25.0.0 arm64 arm
What steps can reproduce the bug?
Install Codex Cli, login with chatgpt
What is the expected behavior?
Logs in and authenticates properly
What do you see instead?
Error response
Error code: 500
Message: Token exchange failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1028)>.
Error code explanation: 500 - Server got itself in trouble.
Additional information
No response
Are you on a headless machine?
If so, please see https://github.com/openai/codex/issues/1243#issuecomment-3165318852
Are you on a headless machine?
If so, please see #1243 (comment)
Not on headless, on MacBook with everything setup (display, keyboard, trackpad)
Hmm, what is python3 -V?
(Also just confirming that you aren't trying to use this in a Docker container, despite being on a Mac.)
same problem! Error Message in Codex: Error logging in: login_with_chatgpt subprocess failed:
i was getting error 500 on macOS like the original post, this following steps fixed the issue for me:
-
Make sure pip is available python3 -m ensurepip --upgrade
-
Upgrade certifi for the latest CA bundle python3 -m pip install --upgrade certifi
-
Point SSL_CERT_FILE to certifi’s bundle export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"
-
Run the login flow again codex login
Just sharing what worked on my machine, run at your own discretion.
python3 -m ensurepip --upgrade Looking in links: /var/folders/wg/90ttqb114y1g4kqsrbt0fy8m0000gn/T/tmploamjnvc Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages (24.3.1) ❯ python3 -m pip install --upgrade certifi Collecting certifi Downloading certifi-2025.8.3-py3-none-any.whl.metadata (2.4 kB) Downloading certifi-2025.8.3-py3-none-any.whl (161 kB) Installing collected packages: certifi Successfully installed certifi-2025.8.3
[notice] A new release of pip is available: 24.3.1 -> 25.2 [notice] To update, run: python3 -m pip install --upgrade pip ❯ export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')" ❯ codex login Starting local login server on http://localhost:1455 . If your browser did not open, navigate to this URL to authenticate:
https://auth.openai.com/oauth/authorize? XXX Successfully logged in
Worked for me - Thanxs! For the fast Support!
- export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"
Worked, thank you!
After logging in, I get #1960
i was getting error 500 on macOS like the original post, this following steps fixed the issue for me:
- Make sure pip is available python3 -m ensurepip --upgrade
- Upgrade certifi for the latest CA bundle python3 -m pip install --upgrade certifi
- Point SSL_CERT_FILE to certifi’s bundle export SSL_CERT_FILE="$(python3 -c 'import certifi; print(certifi.where())')"
- Run the login flow again codex login
Just sharing what worked on my machine, run at your own discretion.
Worked for me. MacMini Sequoia 15.6
For reference, the following method also worked:
pip3 install pip-system-certs
https://stackoverflow.com/a/77491061