Skip to content

Instantly share code, notes, and snippets.

@shakahl
Created September 11, 2026 10:06
Show Gist options
  • Select an option

  • Save shakahl/704bbff41d1768408fbf353e8f63090a to your computer and use it in GitHub Desktop.

Select an option

Save shakahl/704bbff41d1768408fbf353e8f63090a to your computer and use it in GitHub Desktop.
Prune Claude Code Data on MacOS

Prune Claude Code Data

If by claude-code you mean Claude Desktop (/Applications/Claude.app) and its Code mode, you can reset it to essentially a first-run state without uninstalling the app. Current Claude Desktop uses bundle ID com.anthropic.claudefordesktop, and its Code/VM/session data lives primarily under ~/Library/Application Support/Claude/. (GitHub)

Full local reset

Quit Claude first, then run:

osascript -e 'quit app "Claude"' 2>/dev/null || true
sleep 2

# Stop helpers / embedded Claude Code processes that may still be alive.
pkill -f '/Applications/Claude.app/' 2>/dev/null || true
pkill -f "$HOME/Library/Application Support/Claude/" 2>/dev/null || true

# Main Desktop application data.
rm -rf -- \
  "$HOME/Library/Application Support/Claude" \
  "$HOME/Library/Application Support/Claude-3p" \
  "$HOME/Library/Caches/com.anthropic.claudefordesktop" \
  "$HOME/Library/Caches/com.anthropic.claudefordesktop.ShipIt" \
  "$HOME/Library/Caches/Claude" \
  "$HOME/Library/HTTPStorages/com.anthropic.claudefordesktop" \
  "$HOME/Library/Saved Application State/com.anthropic.claudefordesktop.savedState" \
  "$HOME/Library/Logs/Claude"

# Preferences.
rm -f -- \
  "$HOME/Library/Preferences/com.anthropic.claudefordesktop.plist"

rm -f -- \
  "$HOME/Library/Preferences/ByHost/com.anthropic.claudefordesktop"*.plist \
  "$HOME/Library/Preferences/ByHost/com.anthropic.claudefordesktop.ShipIt."*.plist \
  2>/dev/null

defaults delete com.anthropic.claudefordesktop 2>/dev/null || true

# Electron/Chromium credential encryption entry, if present.
security delete-generic-password \
  -s "Claude Safe Storage" \
  "$HOME/Library/Keychains/login.keychain-db" \
  2>/dev/null || true

# Temporary Claude Code settings generated by Desktop.
find /private/tmp -maxdepth 1 \
  -user "$USER" \
  -name 'claude-settings-*.json' \
  -delete 2>/dev/null || true

# Reset macOS privacy grants for the Desktop application.
tccutil reset All com.anthropic.claudefordesktop 2>/dev/null || true

Those locations include the embedded Claude Code binary, VM images, Code/Cowork sessions, Electron local/session storage, IndexedDB, caches and updater state. Recent macOS reports confirm paths such as claude-code/, claude-code-vm/, claude-code-sessions/, and local-agent-mode-sessions/ underneath ~/Library/Application Support/Claude. (GitHub)

On the next launch, Claude Desktop should behave like a fresh local installation: you'll need to sign in again, permissions may be requested again, and Code/Cowork components may be downloaded again.

If you also use standalone Claude Code CLI

The commands above deliberately do not touch your CLI state. Claude Code CLI has separate/shared user-level state such as:

~/.claude/
~/.claude.json
~/Library/Caches/claude-cli-nodejs/

To wipe that too:

rm -rf -- \
  "$HOME/.claude" \
  "$HOME/Library/Caches/claude-cli-nodejs"

rm -f -- \
  "$HOME/.claude.json" \
  "$HOME/.claude-code-now-last-dir"

~/.claude/ can contain CLI history, settings, plugins, user-level CLAUDE.md, project session information and browser-integration files, so don't remove it if you only want to reset the Desktop app. Anthropic documents ~/.claude/CLAUDE.md as user-wide Claude Code configuration. (Claude)

Also, this does not delete project-controlled files such as:

your-project/.claude/
your-project/CLAUDE.md
your-project/.mcp.json

Those belong to the projects themselves.

Browser integration residue

If you've enabled Claude's Chrome integration, Desktop may also have installed this native-messaging manifest:

rm -f -- \
  "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.anthropic.claude_browser_extension.json"

Only remove it if you want the browser integration reset too. Claude Desktop currently registers that manifest to /Applications/Claude.app/Contents/Helpers/chrome-native-host. (GitHub)

Check whether anything remains

I recommend auditing rather than indiscriminately deleting everything containing “Anthropic”:

find "$HOME/Library" -maxdepth 5 \
  \( -iname '*claude*' -o -iname '*anthropic*' \) \
  -print 2>/dev/null

Also inspect the system-level managed configuration:

ls -la "/Library/Application Support/ClaudeCode" 2>/dev/null

Anthropic uses /Library/Application Support/ClaudeCode/ for machine-wide managed policies, not ordinary user data, so I would not sudo rm -rf that directory unless this is your own unmanaged Mac and you explicitly want those policies gone too. (Claude)

Finally, this is a local Mac reset. It does not delete conversations or other account data stored on Anthropic's servers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment