Black Friday Sale - 50% off Pro & FamilyGet the deal
Skip to content

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.

Diskfern logo, the app icon of the Mac disk space analyzerDiskfern Team10 min readUpdated

Short answer

ENOSPC: no space left on device means a write failed because the place being written to was full. On a Mac running Claude Code, that place is one of three things: your actual disk, a folder Claude Code writes to such as ~/.claude, or a virtual disk inside the Claude sandbox or a Cowork session that your Mac's free space cannot help. The error text tells you which. Read it first, because cleaning your Mac will not fix a full Cowork session, and deleting ~/.claude will not fix a full disk.
Grav at a diagnostic workstation inspecting separate canisters for Mac disk space, the Cowork VM session, and Claude sandbox VM bundles
Grav at a diagnostic workstation inspecting separate canisters for Mac disk space, the Cowork VM session, and Claude sandbox VM bundles.
On this page

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/Data

If 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 -h

Then find out which directory is largest:

$du -sh ~/.claude/* 2>/dev/null | sort -h | tail
Where Claude Code stores data and tips
DirectoryContentSafe 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 filesSafe 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.

Size of local (macOS (apple silicon) Claude Code components Nov 2026)
Component LocationSizeContents
~/.claude/projects/304 MBConversation transcripts and output from tools.
~/.claude/file-history/8.4 MBSnapshots of files before edits for restoring checkpoints.
~/.claude/skills & plugins7.4 MBSkills, plugins and helper tools for agents.
~/.claude/debug/0 BDebug logs (only created if --debug flag used).
~/.local/share/claude/versions/0 BCLI versions (not populated by installing via npm)
~/Library/Application Support/Claude/0 BVM bundles for Claude desktop application sandbox (not installed)
Total size ~/.claude321 MBConfiguration 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:

  1. Ensure you have the latest version of Claude app and Claude Code, and start a new session.
  2. Try a different project in case the large synced directory is the issue.
  3. 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 a target/ of 9.8GB. node_modules can be very large in individual folders, ranging from 134MB to 1.5GB. If cleaning, run cargo clean --dry-run first.
  • 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.

  1. 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.
  2. Customise retention. In your Claude Code settings.json file, change the value for cleanupPeriodDays to 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.
  3. Don't save transcripts for disposable work. As described in Anthropic's documentation, setting the environmental variable CLAUDE_CODE_SKIP_PROMPT_HISTORY prevents saving transcripts and prompt history. Alternatively, using --no-session-persistence for non-interactive operations.
  4. 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.
  5. 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.

  1. Launch Diskfern and scan your primary disk container or your project volume.
  2. Open the Developer Storage category to see Claude Code, package managers, and VM bundles broken out by size.
  3. Inspect Safe items like build artifacts and old logs, while keeping configuration files and active credentials protected.
  4. 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 Diskfern

Questions

What does “ENOSPC: no space left on device” mean in Claude Code?
A write failed because the target disk or folder had no free space. It does not say which disk. Check the path in the error: a normal path points to your Mac or project volume, while /sessions/... points to the Cowork VM.
Why do I get ENOSPC when my Mac has free space?
Four common reasons. Your project is on a different, full volume. Finder is counting purgeable space that is not free yet. The error is from the Cowork VM, not your Mac. Or the sandbox VM bundle filled the disk and you freed some of it since. Run df -h . and df -h /System/Volumes/Data to compare.
Is it safe to delete the .claude folder?
Not the whole folder. It contains your settings, CLAUDE.md, skills and agents as well as transcripts and logs. Remove specific data folders after checking what you would lose, or use the project purge command for one project.
Will deleting transcripts break Claude Code?
No, new sessions are unaffected. You lose the ability to resume or rewind old sessions and the history shown with the up arrow.
Does Claude Code delete old files by itself?
Yes. It removes older session data at startup based on cleanupPeriodDays, which defaults to 30 days according to the documentation. The exact folders covered vary by version, so check the current docs.
How do I fix “no space left on device” in Cowork?
There is no confirmed user-side fix in public reports, and freeing Mac space does not help because the VM disk is separate. Update, start a fresh session, try another project, then report the exact error and session path to Anthropic.
Diskfern logo, the app icon of the Mac disk space analyzer

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

Diskfern app icon for macOS, the disk space analyzer that shows what is filling your Mac storage

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