How to free up disk space taken by Claude Code on a Mac

Transcripts, checkpoints, scratch folders and worktrees: what Claude Code keeps, what you can delete and what you should leave alone.

6 min read · Updated October 9, 2026

Claude Code writes a lot to disk while it works. Every session leaves a transcript, every edit can leave a checkpoint, and worktrees bring a full checkout of your project. After a few months of heavy use this adds up to gigabytes. Most of it is safe to clean, some of it isn't, and Claude Code already cleans part of it by itself.

Where Claude Code keeps its data

Almost everything is in ~/.claude in your home folder. Two other places matter: the temporary folder macOS gives your user, and .claude/worktrees inside your repositories.

Folder What it holds Who cleans it
~/.claude/projects Session transcripts (.jsonl), subagent transcripts, large tool outputs, and each project's auto memory in memory/ Claude Code, after cleanupPeriodDays; memory files are kept
~/.claude/file-history Snapshots of files taken before Claude edited them, used to restore checkpoints Claude Code, after cleanupPeriodDays
~/.claude/debug, ~/.claude/paste-cache, ~/.claude/plans, ~/.claude/shell-snapshots Debug logs, large pastes, plan files, shell setup captured at startup Claude Code, after cleanupPeriodDays
~/.claude/todos, ~/.claude/image-cache Legacy folders that current versions no longer write Claude Code's sweep
/private/tmp/claude-<uid> Each session's scratchpad and pasted images, one folder per project and session Deleted with the session's transcript; macOS may also clear it on restart
.claude/worktrees in a repository Worktrees made by claude --worktree and by subagents You, or the sweep for subagent and background-session worktrees

<uid> is your numeric user id; id -u prints it. If you set CLAUDE_CONFIG_DIR or CLAUDE_CODE_TMPDIR, these folders live wherever those point.

What you should never delete

Some files in ~/.claude are not data you can rebuild:

  • ~/.claude.json: your account and global state, including each project's trust and MCP servers
  • ~/.claude/settings.json and settings.local.json: your settings
  • ~/.claude/.credentials.json: your login
  • ~/.claude/plugins: installed plugins, managed with /plugin
  • ~/.claude/agent-memory and projects/<project>/memory/: subagent memory and each project's auto memory

~/.claude/history.jsonl is your prompt history. Deleting it frees little and loses up-arrow recall and Ctrl+R search.

Let Claude Code clean up by itself

Claude Code deletes transcripts, checkpoints, debug logs, pasted content and its other session files once they are older than cleanupPeriodDays. The default is 30 days and the minimum is 1; 0 is rejected. The same cutoff applies to orphaned subagent worktrees, and a session's scratchpad goes when its transcript goes.

To keep less, set a lower number in ~/.claude/settings.json:

{
  "cleanupPeriodDays": 14
}

A shorter period also means you can't resume or rewind sessions older than that. Auto memory is not swept.

Look before you delete

These commands only read. Start with the totals, then the biggest folders:

# Total size of Claude Code's data
du -sh ~/.claude

# Each folder inside it, biggest last
du -sh ~/.claude/* 2>/dev/null | sort -h

# Transcripts per project, biggest last
du -sh ~/.claude/projects/* 2>/dev/null | sort -h | tail -15

# Scratch folders in the temporary folder
du -sh /private/tmp/claude-$(id -u)/* 2>/dev/null | sort -h

# Worktrees Claude Code made in your repositories
ls -d ~/projects/*/.claude/worktrees/* 2>/dev/null

The folder names in ~/.claude/projects are your project paths with every character other than letters and digits turned into -, so -Users-you-my-app is /Users/you/my-app. Projects whose folders you deleted long ago are usually the easiest win.

Clean one project with claude purge

Deleting transcripts by hand works, but Claude Code has its own command for a project's history. Always preview first:

# Shows the plan, deletes nothing
claude purge ~/work/my-repo --dry-run

claude purge deletes the project's transcripts and auto memory under projects/, its tasks/, debug/ and file-history/ entries, its lines in history.jsonl and its entry in ~/.claude.json. It doesn't touch scratchpads or pasted images in the temporary folder. Before v2.1.288 the command was claude project purge.

# DELETES: asks for confirmation, then deletes permanently (no Trash)
claude purge ~/work/my-repo

Avoid --all unless you mean it: it purges every project and deletes history.jsonl outright.

Deleting by hand

Quit your Claude Code sessions first; a running session still uses its scratchpad and shell snapshot. To check:

pgrep -fl claude

Then move what you no longer need to the Trash rather than deleting it. The trash command comes with macOS 15 and later:

# Moves to the Trash: debug logs and leftover shell snapshots
trash ~/.claude/debug ~/.claude/shell-snapshots

# Moves to the Trash: one project's scratch folders
trash /private/tmp/claude-$(id -u)/-Users-you-old-project

What you give up, according to Claude Code's documentation:

Delete You lose
~/.claude/projects Resume, continue and rewind for past sessions, and auto memory for every project
~/.claude/file-history Checkpoint restore for past sessions
~/.claude/paste-cache Pasted text in recalled prompts
~/.claude/debug, plans, shell-snapshots Nothing you'd notice
~/.claude/todos, image-cache Nothing; current versions don't write them

Space moved to the Trash comes back only when you empty the Trash. Worktrees are a separate case: moving one to the Trash leaves git metadata behind and can lose uncommitted work. See How to remove git worktrees left by coding agents, safely.

Doing it with Devbroom

Devbroom finds all of these folders on its own and gives each item a verdict with its reasons. Scanning only reads.

  • Scratch folders of finished sessions are checked one by one and can come out Ready. A running session's scratch folder stays Blocked while the session lasts.
  • Session logs are cleaned with claude purge, never by deleting files. History of projects whose folders no longer exist can be cleared in one go. With Pro you can archive a project's conversations instead: memory stays in place, and you can reopen the archive from History.
  • Checkpoints, logs and caches are shown but left to Claude Code, since it deletes them itself.
  • Your account, credentials, settings, prompt history, agent memory and plugins are never touched.
  • Worktrees are tied to Claude Code by its traces, such as the CLAUDE_BASE marker in git metadata or a lock Claude Code placed. One with uncommitted work is Blocked.

What you confirm moves to the Trash, and Put back returns it. The details are on the Claude Code page and in Rules. Devbroom is free to download.

More guides