Skip to main content

Want to switch from the Mole Mac site to the Windows site?

Go to the Windows site
Mole
MacWindows
Features Tested apps Testimonials Pricing FAQ Blog
EnglishEN 简体中文中 繁體中文繁 日本語日 한국어한 FrançaisFR DeutschDE ItalianoIT EspañolES PortuguêsPT NederlandsNL
Buy Download

    Help, documentation, releases, and articles.

    Blog

    Uninstall Claude Code, Codex CLI and OpenCode on Mac

    UninstallPublished October 31, 20267 min read

    To uninstall Claude Code, Codex CLI or OpenCode on a Mac, remove the installation you actually have before deciding what to do with its data. A missing command and deleted chat history are different outcomes. Keep the data first if you might return to the tool or still use its desktop app or editor extension.

    Decide What to Keep

    Copy wanted settings and local conversations to a backup you can read before removing anything. Do not assume an account sign-in will restore local history. If you only want smaller caches while keeping the tools, use cleaning up AI coding tools instead.

    Tool Default data to review What removal can lose
    Claude Code ~/.claude and ~/.claude.json Settings, permissions, MCP configuration and chat history
    Codex CLI ~/.codex Local configuration, conversations and file-based login data
    OpenCode ~/.local/share/opencode, ~/.config/opencode, ~/.cache/opencode Chats, snapshots, provider credentials, configuration and caches

    The paths come from Claude Code setup, Codex configuration, its history locations, and OpenCode's storage and configuration guides. These are review locations, not a list to delete in bulk.

    Use the Package Manager That Installed It

    Finish active work and end the tool's sessions first. For a package-manager installation, use only the matching row below. Claude's uninstall instructions, OpenAI's installation list, and OpenCode's installation guide identify the package names. npm uninstall with a global flag removes a global package; Homebrew uninstall removes the named formula or cask.

    Installation Removal command
    Claude Code, npm npm uninstall -g @anthropic-ai/claude-code
    Claude Code, Homebrew brew uninstall --cask claude-code
    Codex CLI, npm npm uninstall -g @openai/codex
    Codex CLI, Homebrew brew uninstall --cask codex
    OpenCode, npm npm uninstall -g opencode-ai
    OpenCode, Homebrew V1 tap brew uninstall anomalyco/tap/opencode

    For Claude's separately named latest-channel cask, use brew uninstall --cask claude-code@latest instead. OpenCode's vendor tap and Homebrew's opencode formula can refer to different major versions, so inspect the installed package name first. Do not run every row or add --zap as a shortcut. With multiple Node environments, review each environment's global installation separately.

    Handle Native Installations Separately

    For Claude Code's native installer, Anthropic identifies ~/.local/bin/claude and ~/.local/share/claude. After quitting, move that launcher link and that program folder to the Trash if they match your installation. Leave ~/.claude for the separate data decision.

    For native Codex, OpenAI's installer source defines default launchers under ~/.local/bin and the runtime under ~/.codex/packages/standalone. Inspect the codex and codex-code-mode-host entries there. Move only verified Codex launcher entries and that runtime to the Trash after confirming no retained Codex installation needs them. CODEX_INSTALL_DIR and CODEX_HOME can change these locations. This is a manual removal based on the installer layout, not a documented universal Codex uninstall command.

    For OpenCode installed by its script, use its own uninstaller while the command is still available. Preview first; the second command is the removal choice that retains configuration, chats and snapshots:

    opencode uninstall --dry-run --keep-config --keep-data
    opencode uninstall --keep-config --keep-data
    

    Read the preview before running the second line. Running plain opencode uninstall has a broader data-removal scope. Keep a backup even when choosing retention flags, and preserve shared data if you still use OpenCode Desktop.

    Sign Out and Remove Extensions as Separate Choices

    If you want to sign out too, do that before removing the executable. Claude documents claude auth logout in its authentication guide. Codex documents codex logout in the CLI reference. Its authentication guide says login can be cached in a file or the operating system's credential store, and is shared with the IDE extension. Signing out can therefore affect the extension as well.

    Remove unwanted editor extensions through the editor's extension or plugin manager. The CLI, extension and desktop app are separate installations. Anthropic explicitly warns that its other clients can recreate ~/.claude. The Claude guide covers its desktop app and separate Code removal; the OpenCode guide covers OpenCode Desktop and its shared CLI data.

    Remove Local Data Only If You Mean to Lose It

    For a CLI-only uninstall, stop with the backed-up data still present. For a deliberate data reset, quit every client sharing it, verify your backup, then move only the exact unwanted locations from the first table to the Trash. Deleting ~/.codex also removes native runtime files stored inside it, so it is not a program-only uninstall.

    Custom configuration directories and project files need separate review. Anthropic documents CLAUDE_CONFIG_DIR, and OpenCode offers opencode debug paths to show its active data, config, cache and state paths. Check these before uninstalling, rather than assuming the defaults apply. Project .claude, .mcp.json and .opencode content may be shared team configuration. Keep project source and worktree changes you need; do not delete a repository to remove an assistant.

    Apple's Trash instructions explain restoring an item before emptying the Trash. That recovery lasts only while the item remains there. A package-manager uninstall is not a Trash backup of its program; reinstall through the original channel if needed, and restore data from your checked backup. Cache rebuilding still needs the required packages or other sources to be available.

    Check the Result Without Deleting More

    Open a new terminal using zsh and inspect command resolution:

    type -a claude
    type -a codex
    type -a opencode
    

    A returned path, alias or function needs inspection; it may be another installation. Not found means that shell cannot resolve the command, not that every data folder or extension is gone. Check the editor separately and confirm that the data you chose to keep still exists. For wider desktop-app removal, see AI tool leftovers.

    Where Mole Fits

    Mole Mac's separate AI page handles eligible old conversations, Git-checked worktrees and supported idle CLI removal through its AI-specific deletion policy. Those are separate reviewed choices, not a command to erase a tool's whole home folder.

    OpenCode is in that CLI catalog: an eligible idle installation can be offered for removal, with shared data retained when a desktop co-owner or installed skills require it. Homebrew programs are removed through Homebrew; other eligible program and data targets go to the Trash. Claude Code and Codex are deliberately absent from whole-tool uninstall, so use the manual installation steps above for them. An unchecked row is awaiting your decision, not protected from a later selection.

    FAQ

    Can I Remove Claude Code but Keep Claude Desktop?

    Yes. Remove only the separately installed CLI and unwanted editor extension. Keep shared Claude data while a retained client needs it, and follow the desktop guide only if you also want that app removed.

    Why Does the Command Still Work After Uninstalling?

    Check the new terminal's command resolution. A second package manager, Node environment, native launcher or shell alias can still provide the command. Remove only the installation you identify.

    Will Reinstalling Restore Deleted Chats?

    Do not rely on it. Reinstalling supplies the program, not a backup of deleted local conversations or snapshots. Keep a readable backup and any wanted Trash items until recovery has been checked.

    Mole can clean caches and old versions of Claude Code, Codex and Cursor. Old sessions need your confirmation.

    Try Mole

    Keep reading

    • UninstallHow to Completely Uninstall Apps on Mac Without Losing Data9 min read
    • UninstallHow to Uninstall CleanMyMac and CleanMyMac X on Mac6 min read
    • UninstallRemove Apps From Launchpad or Apps on macOS Tahoe5 min read

    Mole · 鼴

    Cleanup, software, and status for your Mac.

    v1.19.0 (353) · Release notes

    Product

    Mac Cleaner App Uninstaller Mac Optimizer Disk Analyzer System Monitor

    Support

    Help Documentation Releases Blog

    Legal

    Terms of Service Privacy Policy Refund Policy

    Resources

    For Windows CLI Tool Affiliate Program

    Connect

    Twitter hi@mole.fit

    Mole’s only official website mole.fit, avoid installers from unknown sources

    The CLI stays free for terminal workflows.