<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Multiple AI Accounts]]></title><description><![CDATA[Multiple AI Accounts]]></description><link>https://multiple-ai-accounts.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 30 Oct 2026 11:06:29 GMT</lastBuildDate><atom:link href="https://multiple-ai-accounts.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Work and Personal Accounts in Claude Code and Codex CLI, Side by Side]]></title><description><![CDATA[Run work and personal accounts side by side in Claude Code and Codex CLI with CLAUDE_CONFIG_DIR and CODEX_HOME: setup, aliases and common mistakes.]]></description><link>https://multiple-ai-accounts.hashnode.dev/work-and-personal-accounts-in-claude-code-and-codex-cli-side-by-side</link><guid isPermaLink="true">https://multiple-ai-accounts.hashnode.dev/work-and-personal-accounts-in-claude-code-and-codex-cli-side-by-side</guid><category><![CDATA[claude]]></category><category><![CDATA[claude-code]]></category><category><![CDATA[codex]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[terminal]]></category><dc:creator><![CDATA[Sebastian Balog]]></dc:creator><pubDate>Mon, 19 Oct 2026 02:10:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ad57b0939cde4bbff59ac3b/32c0c127-14a6-4d57-aec4-5bc86f31faab.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you write code with AI tools, chances are you have more than one account: one paid by your company, one of your own, maybe one for a client. Both Claude Code and the Codex CLI handle this well, as long as you know about one environment variable each. This post shows the setup I use: two accounts per tool, both signed in, each in its own terminal tab.</p>
<h2>The idea: one config folder per account</h2>
<p>Each CLI keeps everything that identifies you in a single folder:</p>
<table>
<thead>
<tr>
<th>Tool</th>
<th>Variable</th>
<th>Default folder</th>
</tr>
</thead>
<tbody><tr>
<td>Claude Code</td>
<td><code>CLAUDE_CONFIG_DIR</code></td>
<td><code>~/.claude</code></td>
</tr>
<tr>
<td>Codex CLI</td>
<td><code>CODEX_HOME</code></td>
<td><code>~/.codex</code></td>
</tr>
</tbody></table>
<p>Settings, session history and the login all hang off that folder. Point the variable at a different folder and the tool behaves like a fresh install: you sign in once, and from then on that folder stays signed in to that account. The default folder keeps your first account, untouched.</p>
<h2>Claude Code</h2>
<p>Create the folder and start Claude Code with it:</p>
<pre><code class="language-bash">mkdir -p ~/.claude-work
CLAUDE_CONFIG_DIR=~/.claude-work claude
</code></pre>
<p>Log in with your work account when asked. Now a plain <code>claude</code> in one tab uses your personal account, and the command above uses your work account in another. Both can run at the same time.</p>
<h2>Codex CLI</h2>
<p>Same pattern:</p>
<pre><code class="language-bash">mkdir -p ~/.codex-work
CODEX_HOME=~/.codex-work codex
</code></pre>
<p>Sign in with the second account once. Plain <code>codex</code> keeps using <code>~/.codex</code>. If the folder doesn't exist, Codex stops with an error saying the <code>CODEX_HOME</code> path does not exist, so create it first.</p>
<h2>Make it one word</h2>
<p>Typing variables gets old fast. Add aliases to <code>~/.zshrc</code> (or <code>~/.bashrc</code>):</p>
<pre><code class="language-bash">alias claude-work='CLAUDE_CONFIG_DIR="$HOME/.claude-work" claude'
alias codex-work='CODEX_HOME="$HOME/.codex-work" codex'
</code></pre>
<p>Open a new tab or run <code>source ~/.zshrc</code>, and <code>claude-work</code> / <code>codex-work</code> start in the work account. Add one pair per account (<code>claude-client</code>, <code>codex-client</code>, and so on).</p>
<p>If you'd rather switch a whole tab at once, export both variables there:</p>
<pre><code class="language-bash">export CLAUDE_CONFIG_DIR="$HOME/.claude-work"
export CODEX_HOME="$HOME/.codex-work"
</code></pre>
<p>Every <code>claude</code> and <code>codex</code> command in that tab now uses the work account until you close it.</p>
<h2>What to copy between folders, and what not to</h2>
<ul>
<li><p><strong>Copy your settings</strong> if you want the same setup in both accounts. For Codex that's <code>config.toml</code> (including MCP servers): <code>cp ~/.codex/config.toml ~/.codex-work/</code>. For Claude Code, copy <code>settings.json</code> and your global <code>CLAUDE.md</code> if you use one.</p>
</li>
<li><p><strong>Don't copy login files.</strong> In Codex that's <code>auth.json</code>. Copying it puts the first account into the second folder, which defeats the point.</p>
</li>
<li><p><strong>Leave history alone.</strong> Each folder keeps its own sessions, so each account's history stays with that account.</p>
</li>
</ul>
<h2>Three mistakes I made so you don't have to</h2>
<ol>
<li><p><strong>Wrong account in a tab.</strong> Run <code>echo $CLAUDE_CONFIG_DIR $CODEX_HOME</code>. Empty output means the tab is on the default folders.</p>
</li>
<li><p><strong>Logging out everywhere.</strong> <code>codex logout</code> clears the login of the current <code>CODEX_HOME</code>. If everything shares <code>~/.codex</code>, that includes other terminals and the Codex inside the ChatGPT desktop app. Separate folders avoid it.</p>
</li>
<li><p><strong>Forgetting the desktop apps.</strong> These variables only affect the command line. Claude Desktop and the ChatGPT app still keep one account each, and by default the ChatGPT app's Codex shares <code>~/.codex</code> with plain <code>codex</code>.</p>
</li>
</ol>
<h2>What about the desktop apps?</h2>
<p>That last point is where the free setup ends. The desktop apps need their own data folder per account, which means a separate copy of each app. There's a manual way to do it, with rough edges such as one shared Dock icon and Google sign-in landing in the wrong copy. I wrote up every option, free and paid, in <a href="https://multiple-ai-accounts.blogspot.com/2026/10/how-to-use-multiple-claude-and-chatgpt.html">How to Use Multiple Claude and ChatGPT Accounts on One Computer</a>.</p>
<p>Full disclosure: I build two apps that handle the desktop side. <a href="https://doubleclaude.com/">Claude Sessions Pro</a> turns each Claude account into its own app on a Mac, or its own window on Windows. <a href="https://multiplecodex.com/">Sessions Pro for Codex</a> does the same for the ChatGPT app: its own app on a Mac, or its own window on Windows. In both, every profile has an "open in Terminal" button that starts the CLI with that profile's own <code>CLAUDE_CONFIG_DIR</code> or <code>CODEX_HOME</code>, so the terminal and the app are always signed in to the same account.</p>
<p>For the terminal alone, though, the two variables above are all you need. Set them up once and you'll stop logging in and out for good.</p>
]]></content:encoded></item></channel></rss>