MacOS – Where does Visual Studio Code store unsaved files on macOS

macosvisual-studio-code

This has been asked regarding Windows, but not macOS.

(Yes, there's a comment on that question regarding macOS, but it's a comment and not an answer, so it's likely to be overlooked, and it's on a question about Windows, and to top it all off it's wrong.)

So, for sake of making (the correct version of) this information easy to find:

Where does VS Code store unsaved files on macOS?

Best Answer

It can be found in a subdirectory of

~/Library/Application\ Support/Code/Backups

Note that the space above has been escaped with a \ character, so you can copy the path and paste it onto the command line.

If you want to put it in quotation marks, then you'll need drop \ character, and replace ~ with $HOME, like so:

"$HOME/Library/Application Support/Code/Backups"

On my laptop the subdirectory is named with a 13-digit number, inside of which is /untitled/. I would guess that the directory above untitled probably varies from installation to installation.

Related Question