DEV Community

Serhii Tkachenko
Serhii Tkachenko

Posted on

Codex asked for a phone number I no longer have - here's how I signed in on Raspberry Pi

I use a Raspberry Pi as a small home development server, so I wanted to run OpenAI Codex on it and control it from my phone. Installing Codex CLI over SSH was easy. The difficult part was signing in when OAuth required an old phone number I could no longer access, and then making the Pi appear as its own online computer in ChatGPT Remote.

At first, I assumed this was not possible. ChatGPT Remote is usually presented as a feature for the desktop app on Windows and macOS. However, the current Codex CLI also contains remote-control commands. After testing them on my Raspberry Pi, I got the result I wanted: the Pi appeared in the ChatGPT mobile app under its own hostname, and I could open its projects and continue Codex conversations remotely.

There were two separate problems to solve. First, Codex had to be authenticated on the Pi even though the new OAuth flow requested verification through an inaccessible number. Second, its remote-control daemon had to remain running before the phone could pair with it. Here is the full process that worked for me.

Important: Remote Control availability can depend on your ChatGPT account, workspace, app version, and staged feature rollout. The commands below exist in the current Codex CLI, but the Remote interface may not yet appear for every user.

What you need

I used the following setup:

  • A Raspberry Pi running a 64-bit Linux distribution
  • Internet access on the Pi
  • SSH access to the Pi
  • A ChatGPT account with Codex access
  • The latest ChatGPT app on an Android or iOS phone
  • A recent version of Codex CLI
  • Another trusted computer where Codex is already signed in, if you cannot complete a new login on the Pi

You do not need to expose a port on your router. Remote Control uses an outgoing connection and a secure relay. The pairing command communicates with a local Unix socket on the Pi, not with a public TCP port.

1. Install Codex CLI on the Raspberry Pi

Connect to the Pi locally or over SSH, then run OpenAI's Linux installer:

curl -fsSL https://chatgpt.com/codex/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Installing Codex CLI on Raspberry Pi

The installer places Codex in ~/.local/bin and adds that directory to your shell configuration. However, the terminal window that ran the installer may not reload the updated PATH automatically.

If you immediately see codex: command not found, do not reinstall Codex. Activate the new path in the current terminal instead:

source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

If the command is still not found, use the exact temporary command printed by the installer:

export PATH="$HOME/.local/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

Now check that Codex is available:

codex --version
Enter fullscreen mode Exit fullscreen mode

Codex version after updating PATH

You can update Codex later by running the same installer again.

Next, enter the directory containing the project you want Codex to use and launch it:

cd ~/your-project
codex
Enter fullscreen mode Exit fullscreen mode

Replace ~/your-project with a real folder. It is only an example path.

2. Try the normal Codex sign-in

On a normal setup, running codex starts the ChatGPT sign-in flow. Codex also offers device authentication for remote or headless computers:

codex login --device-auth
Enter fullscreen mode Exit fullscreen mode

Follow the URL and code printed in the terminal. Once authentication is complete, verify it with:

codex login status
Enter fullscreen mode Exit fullscreen mode

The successful result should say:

Logged in using ChatGPT
Enter fullscreen mode Exit fullscreen mode

Codex login status on Raspberry Pi

If the regular login works, skip to the Remote Control section below.

3. Copy an existing Codex login to the Pi

I ran into an unusual account problem. I could use ChatGPT normally, but the new Codex OAuth flow requested verification through an old phone number that I no longer had. Device authentication led to the same verification page.

Important: This does not bypass phone verification or create a new authenticated session. It transfers an existing valid Codex login between two computers owned by the same user. Both computers must be trusted and belong to you.

Codex was already signed in on my Windows PC, so I used OpenAI's documented fallback for a trusted remote machine: I copied its existing auth.json credential cache to the Pi.

This can also be useful for headless systems where completing a browser login is inconvenient.

First, make sure the authenticated computer actually has the file. In Windows PowerShell, run:

Get-Item $env:USERPROFILE\.codex\auth.json
Enter fullscreen mode Exit fullscreen mode

If it exists, copy it to your Pi. Replace the username, hostname, and home directory if yours are different:

scp $env:USERPROFILE\.codex\auth.json serhii@raspberrypi:/home/serhii/auth.json
Enter fullscreen mode Exit fullscreen mode

If the hostname cannot be resolved, use the Pi's local IP address instead:

scp $env:USERPROFILE\.codex\auth.json serhii@192.168.1.144:/home/serhii/auth.json
Enter fullscreen mode Exit fullscreen mode

Copying auth.json from Windows to Raspberry Pi

Then, on the Raspberry Pi, run:

mkdir -p ~/.codex
mv ~/auth.json ~/.codex/auth.json
chmod 600 ~/.codex/auth.json
codex login status
Enter fullscreen mode Exit fullscreen mode

After I did this, Codex reported that it was logged in using ChatGPT and worked without asking me to verify the old phone number again.

There are several security rules you should not ignore:

  • Only copy this file between computers you own and trust.
  • Treat auth.json like a password because it contains access and refresh tokens.
  • Never upload it to GitHub, cloud notes, a support ticket, a forum post, or a chat.
  • Never include its contents in a screenshot.
  • Do not run codex logout on the source machine immediately before copying the file.
  • Avoid using independent copies simultaneously on multiple machines because refresh-token rotation can invalidate one of them.

Your system may store credentials in the operating system keychain instead of auth.json. In that case, this file-copy method will not apply until file-backed credential storage is configured.

Codex authenticated on Raspberry Pi

Codex working after auth.json transfer

4. Enable Remote Control in Codex CLI

On the Raspberry Pi, enable the Remote Control feature:

codex features enable remote_control
Enter fullscreen mode Exit fullscreen mode

Codex should confirm that the feature was enabled in config.toml.

Enabling Codex Remote Control

You can run Remote Control in the foreground for a quick test:

codex remote-control
Enter fullscreen mode Exit fullscreen mode

However, closing the terminal or pressing Ctrl+C stops that process. For an always-on Raspberry Pi, start the local daemon instead:

codex remote-control start
Enter fullscreen mode Exit fullscreen mode

The important difference is that start leaves the app-server running in the background. This was the missing step in my setup.

Starting the Codex Remote Control daemon

5. Pair the Raspberry Pi with ChatGPT on your phone

After the daemon is running, create a short-lived manual pairing code:

codex remote-control pair
Enter fullscreen mode Exit fullscreen mode

Open ChatGPT on your phone, go to Remote, and complete the pairing flow with the code shown in the terminal. Make sure the phone and Codex CLI use the same ChatGPT account and workspace.

Do not publish a screenshot while the pairing code is still valid. Pair first, wait for the code to expire, and only then make a redacted screenshot if you need one for documentation.

After pairing, my Raspberry Pi appeared in the app as raspberrypi with a green online indicator. I could see its projects and Codex threads and continue working with them from my phone.

Raspberry Pi online in ChatGPT Remote

ChatGPT Remote on a phone

A Codex task opened remotely on a phone

6. Test a real task

From the Pi, open a project and launch Codex:

cd ~/your-project
codex
Enter fullscreen mode Exit fullscreen mode

Inside Codex, try a harmless instruction such as:

Explain the structure of this project and identify its entry point.
Enter fullscreen mode Exit fullscreen mode

You can then open the same task from ChatGPT Remote on your phone, send a follow-up instruction, review output, and approve actions when requested.

One easy mistake is typing a natural-language Codex prompt directly into Bash. If Bash responds with something such as command not found, start codex first and enter the request at the Codex prompt.

Troubleshooting

Connection refused when running pair

I initially received this error:

Error: failed to connect to ~/.codex/app-server-control/app-server-control.sock
Connection refused (os error 111)
Enter fullscreen mode Exit fullscreen mode

This does not mean you need to open a firewall port. It means pair found the local control socket, but the app-server daemon was not running. Start it and try again:

codex remote-control start
codex remote-control pair
Enter fullscreen mode Exit fullscreen mode

In my case, I had previously run Remote Control in the foreground and stopped it with Ctrl+C. Starting the daemon fixed the error.

codex: command not found immediately after installation

The standalone installer normally puts the executable in ~/.local/bin and updates .bashrc for future terminals. The current terminal may still be using the old PATH. Reload the shell configuration:

source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

Or update PATH directly for the current session:

export PATH="$HOME/.local/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

Then verify the installation:

codex --version
Enter fullscreen mode Exit fullscreen mode

Running the installer repeatedly will not fix an unchanged PATH in the already-open terminal.

The Raspberry Pi does not appear in the app

Try the following:

  1. Update Codex by running the installer again.
  2. Update the ChatGPT mobile app.
  3. Confirm both devices use the same ChatGPT account and workspace.
  4. Confirm authentication with codex login status.
  5. Restart the daemon with codex remote-control stop, followed by codex remote-control start.
  6. Generate a fresh code with codex remote-control pair because pairing codes expire quickly.
  7. Fully close and reopen the ChatGPT mobile app.

If the remote-control command is not present, inspect the installed CLI version and available commands:

codex --version
codex remote-control --help
Enter fullscreen mode Exit fullscreen mode

Feature availability can vary by rollout or workspace policy. Managed ChatGPT workspaces can also disable Remote Control.

Codex warns that Bubblewrap is missing

My Pi displayed a warning about bubblewrap. Codex could still use its bundled fallback, so this was not the reason Remote Control failed. If your distribution provides the package and you want to remove the warning, install it with:

sudo apt update
sudo apt install bubblewrap
Enter fullscreen mode Exit fullscreen mode

Why I prefer the Raspberry Pi as a Codex host

A Raspberry Pi is quiet, uses little power, and can stay online without tying up my main PC. My projects and development tools remain on the Pi, while the ChatGPT mobile app becomes a convenient remote interface. I can start a task from my phone, check progress, answer Codex questions, and review results without carrying a laptop.

This setup does not make the Pi a public server and does not require port forwarding. It simply combines Codex CLI's local access to the Pi with ChatGPT's paired Remote interface.

The most important lesson from my troubleshooting was that authentication and pairing are separate. A successful Codex login does not automatically make the Pi appear in Remote. The app-server daemon must be running before codex remote-control pair can create a usable pairing code. Once I corrected that, the connection worked immediately.

Sources

Top comments (0)