Use the installed Codex app for your primary account. You only need one custom launcher for the second account.
The second launcher needs two isolated directories:
| State | Location |
|---|---|
| Codex configuration and authentication | ~/.codex-work |
| Desktop application data | ~/Library/Application Support/Codex Second |
CODEX_HOME isolates Codex state. The separate --user-data-dir prevents Electron from handing the second launch back to the primary app.
test the second account
Run this in Terminal:
mkdir -p "$HOME/.codex-work"
mkdir -p "$HOME/Library/Application Support/Codex Second"
open -n -a Codex \
--env "CODEX_HOME=$HOME/.codex-work" \
--args "--user-data-dir=$HOME/Library/Application Support/Codex Second"
A second Codex window should open. Sign into your other ChatGPT account.
create one Dock launcher
Open Script Editor and paste:
set homePath to system attribute "HOME"
set codexHome to "CODEX_HOME=" & homePath & "/.codex-work"
set appData to homePath & "/Library/Application Support/Codex Second"
set processPattern to "^/Applications/ChatGPT\\.app/Contents/MacOS/ChatGPT --user-data-dir=" & appData & "($| )"
set findProcess to "/usr/bin/pgrep -f " & quoted form of processPattern & " | /usr/bin/head -n 1 || true"
set secondPid to do shell script findProcess
if secondPid is "" then
do shell script "/bin/mkdir -p " & quoted form of (homePath & "/.codex-work") & " " & quoted form of appData & " && /usr/bin/open -n -a Codex --env " & quoted form of codexHome & " --args " & quoted form of ("--user-data-dir=" & appData)
repeat 20 times
delay 0.25
set secondPid to do shell script findProcess
if secondPid is not "" then exit repeat
end repeat
end if
if secondPid is not "" then
tell application "System Events" to set frontmost of first application process whose unix id is (secondPid as integer) to true
end if
Choose File → Save, set File Format to Application, and save it as:
~/Applications/Codex Second.app
The focus section matters. Clicking the pinned launcher will bring the isolated Codex window forward instead of making you click its temporary running-process icon.
macOS may ask whether Codex Second can control System Events. Allow it so the launcher can focus the correct window.
use the original Codex icon
To give the launcher the same icon as the installed app:
- Select Codex in
/Applicationsand pressCommand-I. - Click the icon in the top-left corner and press
Command-C. - Select
Codex Second.appin~/Applicationsand pressCommand-I. - Click its icon and press
Command-V.
Drag only Codex Second.app into the Dock. Keep using the normal installed Codex icon for your primary account.
verify both accounts
Open normal Codex, then click Codex Second in the Dock. Run:
pgrep -alf "ChatGPT.app/Contents/MacOS/ChatGPT"
You should see two main processes. The second includes:
--user-data-dir=/Users/you/Library/Application Support/Codex Second
Each window should remember its own ChatGPT account after quitting and reopening.
Do not put either profile directory in a repository or public sync folder. The setup isolates local profiles; it does not combine usage limits or billing.
Sources: