Skip to content

VS Code's own folder grows with every workspace you ever opened

Extensions, per workspace state and cached data build up in three folders. Which is safe to clear and what you lose from each.

5 min read

An editor feels like it should be small, and the application is. What is not small is the collection of extensions, per workspace state and cached language data it builds up, none of which is removed when you stop working on a project.

The three folders

du -sh ~/.vscode/extensions ~/Library/Application\ Support/Code/* \
  2>/dev/null | sort -h | tail -12
FolderHoldsSafe to clear
~/.vscode/extensionsEvery installed extension, and old versionsUninstall through the editor
Application Support/Code/User/workspaceStorageState for every folder you have openedYes, you lose per project UI state
Application Support/Code/CachedDataCompiled script cache per versionYes, rebuilt on next launch
Application Support/Code/logsSession logsYes
Application Support/Code/User/HistoryLocal file historyOnly if you do not use it

workspaceStorage is the one that surprises people

Every folder you have ever opened gets a directory here, keyed by a hash, and it stays after the project is deleted. On a machine used for a few years this is hundreds of folders for projects that no longer exist.

ls ~/Library/Application\ Support/Code/User/workspaceStorage | wc -l

Clearing it loses per project editor state such as open tabs, search history and some extension data. It does not touch your code, your settings or your extensions. For most people that is an acceptable trade once.

Extensions, including the versions you replaced

Extension folders are named with a version suffix, and updates sometimes leave the previous version in place. Sort the folder and look for the same extension appearing twice:

du -sh ~/.vscode/extensions/* 2>/dev/null | sort -h | tail -15

Language servers are usually the large ones, because they ship a runtime or a compiler. That is also why removing an extension you no longer use is worth more than it looks: you are removing a toolchain, not a plugin.

The rest of the toolchain

An editor is rarely the largest developer folder on a Mac. It sits alongside the package caches, language version managers and the build output in your projects, and the last of those is usually the winner. node_modules across every project has the command for that.

Common questions

Where does VS Code store extensions on a Mac?

In ~/.vscode/extensions, one folder per extension and version. Language servers are usually the largest, because they bundle a runtime or compiler rather than just editor code.

What is workspaceStorage in VS Code?

A folder of per project state, one directory for every folder you have ever opened, kept under Application Support. It is not removed when a project is deleted, so it accumulates for years. Clearing it loses editor state such as open tabs, not code or settings.

Is it safe to delete the VS Code cache?

Yes for CachedData and logs, which are rebuilt or simply not needed. Be more careful with the User folder, which holds settings, keybindings and local file history.

How do I reduce VS Code's disk usage?

Uninstall extensions you no longer use, clear workspaceStorage once, and remove CachedData from older versions. Together these usually recover more than the application itself occupies.

Read next