本文へスキップ
TakoAPI
スキル一覧に戻る

codex-cli-account-switcher

bashar94 作

Codex
—まだ評価がありません
あなたの評価

概要

Easily switch between multiple OpenAI Codex CLI accounts.

説明

# Codex Accounts Switcher 🌀

[![Mentioned in Awesome Codex CLI](https://awesome.re/mentioned-badge.svg)](https://github.com/RoggeOhta/awesome-codex-cli)

**Easily manage multiple OpenAI Codex CLI accounts — switch, save, and restore with one command.**

The official [OpenAI Codex CLI](https://github.com/openai/codex) does **not support multi-account login**.  
Users must manually swap `~/.codex` folders or re-authenticate every time they switch accounts — a painful process for developers who use multiple OpenAI accounts (for example, personal vs work).

I raised this issue here: [#4432](https://github.com/openai/codex/issues/4432)  
and also created a pull request adding multi-account support: [#4457](https://github.com/openai/codex/pull/4457)  
However, the feature hasn’t yet been merged or prioritized, so this standalone script fills that gap.

***I HAVE TESTED THIS ON MAC ONLY***


---

## 🔧 Installation

```bash
# Clone and install
git clone https://github.com/bashar94/codex-cli-account-switcher.git
cd codex-cli-account-switcher
chmod +x codex-accounts.sh

# Optionally make it global
sudo mv codex-accounts.sh /usr/local/bin/codex-accounts
```

## 🚀 Usage
```
codex-accounts list
codex-accounts current
codex-accounts save <name>
codex-accounts add <name>
codex-accounts switch <name>
```
### Examples
```
# Save your current login
codex-accounts save bashar

# Add a new account slot
codex-accounts add tazrin
codex login   # then run:
codex-accounts save tazrin

# Switch between accounts
codex-accounts switch bashar
```
## 📁 Data Locations
Codex stores its session data inside `~/.codex`.
This script backs up each account’s `.codex` directory as a compressed zip file and lets you swap them instantly.

| Path                      | Purpose                              |
| ------------------------- | ------------------------------------ |
| `~/.codex`                | Active Codex session folder          |
| `~/codex-data/<name>.zip` | Saved account backups                |
| `~/.codex-switch/state`   | Tracks current and previous accounts |
| `~/.codex-switch/shared`  | Shared config restored after switch  |

It’s safe to use — your account session data is preserved before every switch.

### Shared (global) `.codex` data
The script keeps these paths common across all accounts (stored in `~/.codex-switch/shared`):
- `rules/`
- `AGENTS.md`
- `config.toml`
- `skills/`
- `memories/`
- `automations/`

These paths are excluded from account zip files and overlaid after each switch, so your global rules/config stay consistent.

## ⚙️ Requirements
- macOS / Linux
- `zip`, `unzip`, `bash`
- Codex CLI installed:
  - macOS: `brew install codex`
  - Linux: use your package manager or follow the [Codex CLI docs](https://developers.openai.com/codex/cli/)

## 🧠 Notes
- Supports unlimited accounts — name-based switching.
- Automatically backs up the current account before changing.
- Shows the current and previous account states.
- Works cross-platform: macOS, Linux, WSL.
- Simple shell-only dependencies (`bash`, `zip`, `unzip`).
- Helpful prompts if Codex isn’t installed or logged in yet.
- You can safely share this across machines (just copy `~/codex-data`).

インストール

https://github.com/bashar94/codex-cli-account-switcher からスキルをインストールして

このスキルはClawHubレジストリには公開されていません。Claude Code、Cursor、Codexなどのコーディングエージェントにプロンプトを貼り付けると、ソースリポジトリから直接インストールされます。

リポジトリを開く

リンク