How to use Claude Code and Codex together on one Mac
To use Claude Code and Codex together on one Mac, open two terminals, give each its own git worktree of your repo, and run claude in one and codex in the other. Put your project's rules in AGENTS.md and import that file from CLAUDE.md, so both tools can load the same rules. A setting or an override file can change what each one loads, as step 2 says.
The steps are below, then two other ways, then what gets hard.
Two terminals, one worktree each
1. Install both and sign in
If you already have both, skip this step. These are the install lines for macOS from the Claude Code quickstart and the Codex CLI page.
curl -fsSL https://claude.ai/install.sh | bash
curl -fsSL https://chatgpt.com/codex/install.sh | shOpen a new terminal window, go to your project and run claude, then codex. The first time, each usually asks you to sign in: Claude Code takes your Claude plan's login, and Codex offers Sign in with ChatGPT. A valid saved login can skip it, since Claude Code and Codex keep the login, and Claude Code also skips it when you approve an API key.
One thing to check: if ANTHROPIC_API_KEY is set on your Mac, Claude Code uses that key instead of your plan once you approve it. Type /status in Claude Code to see which one is in use.
2. Share one set of instructions
Codex looks for AGENTS.md before it does any work. Claude Code, with its default settings, reads CLAUDE.md at the start of every session, and a line starting with @ pulls in another file. So write the rules once, in AGENTS.md at the top of your repo:
# Project rules
- Run `npm test` before you say a change is done.
- Ask before adding a dependency.
- Stay inside the folder you were asked to change.Then make a CLAUDE.md next to it with one line:
@AGENTS.mdTwo things can stop a tool from loading those rules. In Claude Code, if Project instructions in /config is set to managed-only, your project's CLAUDE.md is left out at the start, and the import with it. In Codex, a non-empty AGENTS.override.md in the same folder takes precedence over AGENTS.md. These are not the only ones, so run the checks at the end of this step.
With its default settings, Claude Code from version 2.1.277 can also read AGENTS.md on its own when the folder you work in, and the folders above it, hold no CLAUDE.md, .claude/CLAUDE.md or CLAUDE.local.md. A setting can change that, and some sessions cannot do it. The import line above is the way Claude's page gives to share one file with other coding tools, so keep it. Commit both files now, so that they are in the worktrees you make next.
To see that they loaded, type /context all in Claude Code and look under Memory files, as its memory page says. For Codex, run the check from its AGENTS.md page at the top of your repo:
codex --ask-for-approval never "Summarize the current instructions."3. Make a worktree for each
A git worktree is another folder attached to the same repo, with its own checked-out files. With one each, Claude Code and Codex can edit at the same time without writing over each other. The two below are on a branch each. Open a terminal at the top of your repo and run:
git worktree add ../project-feature-a -b feature-a
git worktree add ../project-feature-b -b feature-bThe first line is from Claude Code's worktrees page, and the second is the same line with another name. Each makes a folder beside your repo, and -b makes a new branch for it. Put in names that your repo does not use yet: git refuses -b with a branch that already exists.
Now open two terminals. Start both at the top of your repo, because the paths below count from there:
cd ../project-feature-a
claudecd ../project-feature-b
codexA worktree is a fresh checkout. Files git does not track, such as .env, are not in it, and you install the project's packages again in each folder.
Both tools can also make a worktree for you: claude --worktree feature-auth starts Claude Code in a new one, and typing /worktree in Codex starts or moves a chat into one.
4. Split the work
Two splits keep the branches easy to join:
- By part of the project. One takes the server folder, the other takes the screens. Name the folder in the first message.
- One builds, the other reads. When one has finished, start the other in that same folder and ask for a review. In Claude Code that is
/code-review. In Codex it is/review, orcodex reviewwith--uncommittedin the terminal.
5. Join the two branches
Commit the work in both folders. Codex's default sandbox keeps .git read-only, so run that commit yourself or approve it if Codex asks. Then go back to your own repo folder, on the branch that should get the work, with nothing uncommitted in it. Merge one branch:
git merge feature-aIf git cannot join the changes by itself, the merge stops with a conflict. Edit the files it marked, git add them and run git merge --continue. To call the merge off, run git merge --abort. Then run your project's checks, and go on only when the merge is finished and they pass.
Now this worktree can go. Copy out anything you still need from it, such as a .env file, then run:
git worktree remove ../project-feature-aGit removes only a clean worktree. If it refuses, look at what is still there.
Then merge the other branch:
git merge feature-bSettle any conflict and run the checks again. When this merge is finished too, remove the second worktree:
git worktree remove ../project-feature-bThe same thing in two desktop apps
If you would rather not use a terminal, the Claude desktop app has a Code tab that runs several Claude Code sessions, and you can turn on Worktree before you start one. In the ChatGPT desktop app, choose Worktree under the box where you type a new Codex chat. Put the two windows side by side.
Codex from inside Claude Code
OpenAI publishes a Codex plugin for Claude Code. You stay in Claude Code, and ask Codex for a review or send it a task. The set-up is on our page about how to hand work from Claude Code to Codex and back, along with a way that needs no plugin.
Where it gets hard
- You carry the news. Each Claude Code session starts with a fresh context window, and Codex has its own chat. What you told one has to be told again to the other, or written in a file both will read.
- A worktree separates files and branches only. Two copies of your app can still want the same port or write to the same local database.
- Two limits, not one. Claude and Claude Code share your Claude plan's limits. Codex uses your ChatGPT plan's allowance. One can run out in the middle of a task while the other carries on.
- Nobody keeps the list. With several tasks open in two terminals, who has which one is in your head.
The commands were checked on 23 November 2026 against the pages linked beside them. If one has changed since, trust that page.