Skip to content
How it worksSafetyPricingQuestions
FR · Français Download
← Where AI coding agents store data on your Mac, and what is safe to delete

OpenCode on Mac: what is in ~/.local/share/opencode and what you can delete

Last checked 20 October 2026

OpenCode keeps sessions and snapshots in ~/.local/share/opencode and packages in ~/.cache/opencode. Logs, tool-output and the cache are safe to delete. Deleting snapshot breaks /undo for past sessions, and deleting storage loses those conversations. Never delete auth.json or ~/.config/opencode.

What OpenCode stores on your Mac

OpenCode follows the Linux habit of splitting its files by role, even on a Mac. ~/.local/share/opencode holds your sessions, snapshots, logs and sign-in. ~/.cache/opencode holds downloaded packages. ~/.config/opencode holds your configuration.

PathWhat it isVerdictWhat you lose
log/OpenCode's internal logsSafeNothing visible
tool-output/Saved output of the tools OpenCode ranSafeNothing visible
~/.cache/opencodeDownloaded provider packages and pluginsSafeNothing visible: OpenCode downloads them again
snapshot/Copies of your files taken before each step, used by /undoReview/undo and Revert can no longer restore files; your files stay as they are
storage/, opencode.dbYour sessions: messages, tool results and diffsReviewPast conversations may be lost; your code is not modified
auth.jsonYour API keys and sign-in tokensNever deleteYou are signed out of your providers
~/.config/opencodeYour configuration and pluginsNever deleteYour setup

Paths without ~ are inside ~/.local/share/opencode. If you set XDG_DATA_HOME or XDG_CACHE_HOME, the folders follow those variables.

What grows the most

Sessions. One user measured about 5.1 GB in ~/.local/share/opencode/storage after five months on one project, growing by roughly 500 MB a month, and asked for a way to prune old sessions because OpenCode has no automatic cleanup.

Snapshots can grow too. OpenCode's documentation says it takes a snapshot before and after each model step, in a separate internal Git database, and that these snapshots can contain the full contents of your files, so treat that folder as sensitive. Turning snapshots off with "snapshots": false stops new ones but does not delete the ones already stored.

To see it on your own Mac:

du -sh ~/.local/share/opencode/* ~/.cache/opencode 2>/dev/null | sort -h
du -sh ~/.local/share/opencode/storage/* 2>/dev/null | sort -h | tail -10

Nothing above deletes anything.

How to clean it by hand

Quit every running opencode session first. Cleaning files a session is writing to can corrupt them.

Safe items can be deleted directly:

rm -rf ~/.local/share/opencode/log ~/.local/share/opencode/tool-output
rm -rf ~/.cache/opencode

OpenCode's troubleshooting guide itself suggests deleting ~/.cache/opencode so the app rebuilds it.

Snapshots: deleting ~/.local/share/opencode/snapshot means /undo and Revert can no longer bring back the files OpenCode changed in past sessions. Your files stay as they are, and your project's own Git history is not touched.

Sessions: storage/ and opencode.db hold your conversations. Deleting them frees the most space, but those sessions are gone for good. Your code is not modified.

What you should never delete

auth.json holds your API keys and sign-in tokens, and ~/.config/opencode your configuration and plugins. Deleting ~/.local/share/opencode as a whole signs you out along with removing every session.

Other command-line agents work the same way: see what is in ~/.copilot and what is in ~/.gemini. For every agent, see where AI coding agents store data on your Mac.

Doing it with Ouste

Ouste reads OpenCode's folders, classifies every item as Safe, Review, Risky or Protected with the sentence that says what you lose, and puts anything you might regret in a 7-day quarantine you can restore in one click. Your sign-in and configuration are never touched.

Questions

Where does OpenCode store its data on a Mac?

In ~/.local/share/opencode for sessions, snapshots, logs and sign-in, ~/.cache/opencode for downloaded packages, and ~/.config/opencode for your configuration.

Is it safe to delete ~/.cache/opencode?

Yes. OpenCode's own troubleshooting guide suggests deleting it; the packages are downloaded again on the next start.

What happens if I delete OpenCode's snapshot folder?

Your files stay as they are, but /undo and Revert can no longer restore the files OpenCode changed in past sessions.

Why is ~/.local/share/opencode/storage so large?

It keeps every session's messages, tool results and diffs, and OpenCode does not clean old sessions automatically. Deleting it removes those conversations for good.

Ouste does this for you. It finds what your agents leave behind, says what each item is and what you lose, and puts anything you might regret in a 7-day quarantine. Free to scan and clean.

Download Ouste

macOS 14 or later · Apple Silicon

Less noise. More control.

Product

  • How it works
  • Safety
  • Pricing
  • Questions

Information

  • Legal notice and terms
  • Privacy
  • Guides
  • contact@ouste.space

Language

  • Français
  • English
© 2026 Ouste. Published by Adeo Consulting, Paris. macOS 14 or later · Apple Silicon