Developer storage
Claude Code “No Space Left on Device” Error on Mac: Causes and Fixes
The same error has three different causes. Read the error text, find the full place, and free space without deleting the wrong thing.
Short answer

On this page
- Step 1: Read the error, then pick your case
- Case A: Full on Mac (or project volume)
- Case B: /sessions/.../tmp in Cowork. VM is full, Mac is fine
- Case C: Sandbox VM bundle in Claude has filled Mac disk
- Why this happens
- Prevention
- Before deletion, know what is taking up space
- The Diskfern way
- Questions
- Sources
Step 1: Read the error, then pick your case
Depending on the error message shown, you may have one of the following cases.
- Case A - ENOSPC from appendFileSync within Claude Code: Full on Mac disk (or project volume)
- Case B - ENOSPC while creating directory /sessions//tmp/claude-1028 within Cowork and all commands fail: Full on Cowork VM disk (not your Mac!)
- Case C - ENOSPC errors in other tools after using sandboxed code execution in Claude Code / Claude app: Full on Mac disk, due to sandbox VM bundle.
These all appear in public reports. One user experienced ENOSPC: no space left on device during appendFileSync in Claude Code, and also the language server plugin crashing in the same session (as would be expected when there is no space left on disk). Other users using Cowork have seen ENOSPC while creating directories in /sessions/.../tmp/claude- but had plenty of space in their mac.
Case A: Full on Mac (or project volume)
If the error message indicates that ENOSPC occurred during appendFileSync on your Mac, you have 0 free space on your boot or external development drive.
Check space
Do not rely on Finder to show the correct space. Instead, open terminal and run:
df -h /System/Volumes/DataIf you are working on a different volume to your boot drive (external SSD, Volume, dev container), make sure to check the space in that:
df -h .Run this from within your project. If the space in the first command is ok, but it shows 100% full in the second command, then your project disk is full. If there is a large discrepancy between Finder and df, this is likely due to snapshots and/or purgeable files. Most discrepancies can be explained with these two factors. If you are running out of space on your Mac and nothing is downloading, find out why deleted files don't free storage and why your Mac keeps losing storage.
Give yourself some free space to re-open Claude Code
To successfully clean up your disk, give yourself a few gigabytes of free space. Find out how much space is used in the relevant directories before deletion:
du -sh ~/.claude ~/.local/share/claude "$HOME/Library/Application Support/Claude" 2>/dev/null | sort -hThen find out which directory is largest:
du -sh ~/.claude/* 2>/dev/null | sort -h | tail| Directory | Content | Safe to delete? |
|---|---|---|
~/.local/share/claude/versions/ | Old versions of Claude Code from self-upgrades (found in 1 example to be 5 directories of roughly 293-306MB) | Safe Safe (once live issues resolved) |
~/.claude/debug/ | Debug logs per session. Only created if started with --debug or /debug. | Safe Safe |
~/.claude/file-history/ | Snapshots of files before editing to allow restore from checkpoints. | Review first Check files first (cannot rewind previous sessions) |
~/.claude/projects/ | Full conversations for the session (.jsonl files) | Review first Check files first (cannot resume sessions or view history) |
~/Library/Application Support/Claude/vm_bundles/ | VM bundle for sandbox in Claude App. | Review first Check files first (See Case C) |
target/, node_modules/, .next/, dist/ | Build files | Safe Safe to rebuild, but may require internet connection to reinstall node_modules |
~/.claude (entire directory) | Contains user configs (CLAUDE.md), skills and agents. | Don't touch Don't delete entire directory |
It is common to make mistakes with this directory. As described by Anthropic, ~/.claude contains user-configured data plus data generated by Claude Code as you use it. This includes conversation transcripts, prompts, file snapshots, caches and logs. Deleting this directory will result in data loss.
Safely delete old versions of Claude Code
Claude Code is updated by downloading a complete new version and changing the pointer to that version. Old versions remain. According to the published clean up guide, you can find them in ~/.local/share/claude/versions/, with a symbolic link from ~/.local/bin/claude to the active version. However, do not delete the oldest versions based on date. If an older version is pinned, or if an update was interrupted, deleting the newest version may cause problems. To find out which version is active in your launcher, run:
readlink -f "$(command -v claude)"ls -lh ~/.local/share/claude/versions/Delete all versions except the one given by the readlink command. Once done, run claude --version, and then empty your trash.
Intentionally delete conversation history
As per documentation, conversation transcripts are unencrypted. As tool outputs are recorded in the session, individual sessions can get very large. To intentionally delete the state of a project, run a purge command. The format of this is slightly different depending on what version you have (run claude --help to find the exact command for your version). This will delete transcripts, automatic memory and per session files for your project.
Note that Claude Code automatically deletes previous session data. This can be configured using the setting cleanupPeriodDays. By default this is 30 days, and is run when Claude Code is started. There is disagreement in published sources as to which sub-directories are deleted (documentation says file-history/ and plans/ are deleted, whereas in testing by one developer, file-history/ was not deleted). To know what is deleted in your version to limit disk space usage, consult the documentation.
| Component Location | Size | Contents |
|---|---|---|
~/.claude/projects/ | 304 MB | Conversation transcripts and output from tools. |
~/.claude/file-history/ | 8.4 MB | Snapshots of files before edits for restoring checkpoints. |
~/.claude/skills & plugins | 7.4 MB | Skills, plugins and helper tools for agents. |
~/.claude/debug/ | 0 B | Debug logs (only created if --debug flag used). |
~/.local/share/claude/versions/ | 0 B | CLI versions (not populated by installing via npm) |
~/Library/Application Support/Claude/ | 0 B | VM bundles for Claude desktop application sandbox (not installed) |
Total size ~/.claude | 321 MB | Configuration for developer agents, and session history. |
Case B: /sessions/.../tmp in Cowork. VM is full, Mac is fine
If the path begins with /sessions/ then the disk that is full belongs to a virtual machine (VM) on Cowork.
Users have reported that they tried to create a directory in /sessions/<name>/tmp/claude-1028, and received the ENOSPC error. All commands (including ls, df -h etc.) failed in bash. They could successfully write files to the mounted mac folder. Opening a new session resulted in the same issue.
Other information from public reports:
- One user reported that the VM was full to start with (without any work being done in the session). They suggested fixing this by making the temporary directory configurable, and monitoring disk space.
- One user reported that the preloaded content in the VM (built in skills and old versions of cached plugins) had filled the VM space.
- Another user (May 2026) reported having this issue in new sessions and projects for over 10 days. When raising a support ticket, they were informed the issue was fixed, but the issue occurred again.
In summary, freeing up space on your mac will not solve this problem. Within public reports there is no confirmed solution from user side. Try the following:
- Ensure you have the latest version of Claude app and Claude Code, and start a new session.
- Try a different project in case the large synced directory is the issue.
- If you continue to have the issue, raise a ticket. Be specific with the error, and the session path. You can raise feedback in the product, or raise an issue on Claude Code GitHub. Try searching for existing issues first.
Do not attempt to clear contents of ~/.claude or caches on your Mac. In this case, as you have free space on your mac and the error is in /sessions/... then you will be clearing the wrong disk.
Case C: Sandbox VM bundle in Claude has filled Mac disk
A large sandbox VM bundle in Claude can result in many gigabytes being used on your mac, causing ENOSPC issues in other tools unexpectedly.
Surprisingly, a user raised an issue on GitHub (macOS) regarding the sandbox VM bundle in Claude Code. The bundle at ~/Library/Application Support/Claude/vm_bundles/claudevm.bundle had grown to 9.7GB, filling the MacBook almost completely. Other unrelated tools were giving ENOSPC errors. The user also noted that there is no visual indication of how much this is using.
In another investigation by Classmethod, the vm_bundles folder was 6.2GB. Despite the file rootfs.img appearing to be 10GB, it is a sparse file meaning only 5.6GB is actually allocated on disk. This can result in widely varying sizes between Finder, ls and disk analysis tools. To check true space allocation, run:
du -sh "$HOME/Library/Application Support/Claude/vm_bundles"ls -lhs "$HOME/Library/Application Support/Claude/vm_bundles"/*Note: In ls -lhs, the first column indicates the actual space used on disk, and the size column indicates apparent size.
If you are not using agents or sandboxed code execution in the Claude app, this is a large amount of space that can be reclaimed. Firstly close the Claude app. In public reports and testing, closing the desktop application and removing this bundle will immediately free up the space. However, within the Claude desktop app there is no toggle to clear this bundle. If sandboxed code execution is used again, the bundle will be re-downloaded.
Why this happens
Agents can cause significantly more disk usage than normal. With coding agents, nearly every edit results in compilation and testing, and a transcript is saved for each session, along with snapshots of files.
Interesting facts
- Builds can be large. In one example, a Rust project has a
target/folder of 24GB. Tauri projects can have atarget/of 9.8GB.node_modulescan be very large in individual folders, ranging from 134MB to 1.5GB. If cleaning, runcargo clean --dry-runfirst. - Logs can quickly increase in size. In Classmethod's review of SSD write issues in reported tools, it was found that infinite logging in debug mode, and inflated file history were previously reported issues in Claude Code. Similarly, in another tool (Codex CLI), heavy disk writes were caused by logging at TRACE level in SQLite. In both cases, it was version specific bugs. Ensure you have the latest version of the tool.
- Once you reach 0 free space, you won't be able to create temporary files in the shell, causing everything to appear broken.
For a general overview of space used by Claude Code and Codex on Mac, see Claude Code and Codex disk usage on Mac. If using Cursor, see Cursor storage on Mac. If using Docker, Xcode or local models (often larger than anything above), see Docker storage, Clear Xcode storage and Where Ollama / LM Studio save models.
Prevention
To avoid running out of disk space due to agent execution, follow the below 5 tips.
- Leave a buffer. Before running agents for a long period of time, run
df -h /System/Volumes/Data. If you only have a few gigabytes of space on your Mac, you will get ENOSPC as soon as builds finish. - Customise retention. In your Claude Code
settings.jsonfile, change the value forcleanupPeriodDaysto match the number of days of history that you want to keep. Increase this value if you wish to keep old sessions, decrease if you wish to reduce the amount of data on disk. - Don't save transcripts for disposable work. As described in Anthropic's documentation, setting the environmental variable
CLAUDE_CODE_SKIP_PROMPT_HISTORYprevents saving transcripts and prompt history. Alternatively, using--no-session-persistencefor non-interactive operations. - Schedule clean up of build files. Or, if unsure which build files to clean, refer to this checklist to identify safe files to delete on Mac.
- Keep updated. Several of the excessive logging issues were fixed in later versions.
If the real issue is that your entire Mac is full, refer to this guide to see what to delete first on a full Mac, or if the large number is hidden in System Data.
Before deletion, know what is taking up space
Whilst knowing which folders are taking up space can be useful, knowing exactly what is in each folder and whether they can be rebuilt is very helpful. Using Diskfern, you can easily see the size of folders in your system. Items are marked Safe, Review First or Don't Touch. If you give Diskfern Full Disk Access, in the Developer view, it will trace ~/.claude, ~/.local/share/claude and ~/Library/Application Support/Claude/vm_bundles, meaning you can easily see what can be reclaimed without guessing.
The Diskfern way
How Diskfern helps
When an ENOSPC error strikes, use Diskfern to verify whether your actual Mac volume is full or if space is consumed by developer caches and VM bundles.
- Launch Diskfern and scan your primary disk container or your project volume.
- Open the Developer Storage category to see Claude Code, package managers, and VM bundles broken out by size.
- Inspect Safe items like build artifacts and old logs, while keeping configuration files and active credentials protected.
- Stage reclaimable items to the Collector and send them to the Trash safely.
Finding and reviewing is free. Moving items to the Trash from Diskfern is part of Pro.
Scan developer storage with DiskfernQuestions
What does “ENOSPC: no space left on device” mean in Claude Code?
Why do I get ENOSPC when my Mac has free space?
Is it safe to delete the .claude folder?
Will deleting transcripts break Claude Code?
Does Claude Code delete old files by itself?
How do I fix “no space left on device” in Cowork?
Written by
Diskfern Team
We explain Mac storage using product behavior and the sources listed below. Review your app settings and backups before removing data.
Sources
- Claude Code GitHub issues: #20848 (ENOSPC appendFileSync), #37581 and #37514 (Cowork /sessions/.../tmp ENOSPC), #47039 (9.7 GB claudevm.bundle), #60029 (persistent Cowork ENOSPC), #51779 (cleanup coverage discrepancies) · checked November 19, 2026
- Anthropic Claude Code documentation: .claude directory, application data paths, cleanupPeriodDays default of 30 days, purge command, CLAUDE_CODE_SKIP_PROMPT_HISTORY · checked November 19, 2026
- Classmethod: Do AI Coding CLI Tools Destroy SSDs? (vm_bundles at 6.2 GB, sparse rootfs.img 10 GB apparent vs 5.6 GB used, reported logging issues) · checked November 19, 2026
- Mole: Clean Up AI Coding Tools on Mac (Claude Code binary layout under ~/.local/share/claude/versions, measured binary sizes, build-output sizes) · checked November 19, 2026
- Bryce Watson: Claude Code deletes old logs and Classmethod: Claude Code conversation history retention (independent tests of what the retention sweep removes) · checked November 19, 2026
Keep reading
Explore more developer storage guides, cache management, and tools.
Claude Code & Codex Disk Space on Mac
Measure Claude Code and Codex storage on your Mac, protect useful session history, and inspect their folders safely before you delete anything.
What is System Data on Mac?
System Data isn't one folder. See what's inside, how much is normal, why macOS 27 Golden Gate inflated it, and how to find your real gap safely.
Mac storage full? What to delete first
A practical, safety-first order for what to check when your Mac says storage is almost full, starting with the easiest wins and ending with what to leave alone.
Clear Xcode storage
Xcode's DerivedData, device support files, old archives, and unused simulators can quietly use tens of gigabytes. Here's what's safe to delete and how.
Developer storage feature
Bring Xcode, Android, Docker, package caches, and local AI models into one readable map.
Get your space back. Start with a free scan.
Explore the files and folders Diskfern can read. Your files stay on your Mac, and nothing is removed until you say so.
macOS 14 Sonoma or later · Apple silicon and Intel