M HYPE SPLASH
// updates

How do I back up my VS Code settings and list of installed extensions?

By John Peck

I've just been through the VS Code installation process twice. The initial install is quick and painless (as is the editor itself), but I have had to remember the list of extensions I installed and am installing new ones a great rate.

With Sublime Text, I'd just copy a settings file to another PC and could auto-install any workflow dependencies that way, but what is the approach with VS Code?

Can I just back up a JSON 'settings' file or similar so that I can easily re-create my working environment (complete with extensions)?

2

5 Answers

I've submitted an answer for this on the main StackOverflow site - pasted below for context

I've need to do this myself a few times - especially when installing on another machine.

Depending on your platform VS Code looks for your extensions folder (.vscode/extensions) on one of the following paths:

  • Windows: %USERPROFILE%\.vscode\extensions
  • Mac: ~/.vscode/extensions
  • Linux: ~/.vscode/extensions

That should show you a list of the extensions

I've also had success using Visual Studio Code Settings Sync Extension to sync settings to GitHub gist

EDIT: In the lastest release of VSCode (May 2016) it is now possible to list the installed extension in the command line

code --list-extensions
3

So as treehead's edit or MarkP's answer showed you can now list all extensions installed so the way to install that list of extensions would be to:

code --list-extensions >> vs_code_extensions_list.txt

Transfer the newly created file to the machine that you want to install those extensions to. On that machine you would:

cat vs_code_extensions_list.txt | xargs -n 1 code --install-extension

Which will then go through each extension in that file and install the extension.

If you want a clean install (AKA remove all existing extensions on that machine) you could run this before you install the new extensions (otherwise you will remove those new extensions too). BE CAREFUL as this will remove all extensions in VS Code:

code --list-extensions | xargs -n 1 code --uninstall-extension
3

Here's the location of the VSCode settings (see below + comments):

Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/ApplicationSupport/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json

It appears to only be storing modified settings, which is really nice (so you don't clobber up or screw with future versions).

You may also want /snippets/, in the same folder as settings.json.

And, of course, you can run code --list-extensions, as the other answers already mention.


Edit: I just discovered a neat little trick! Hit Ctrl+Shift+P to open up the command palette, and then type/select Preferences: Open Settings (JSON). This will open up your settings.json file. Then, you can right click on the settings.json tab, and click Open Containing Folder. This will take you to the folder mentioned above!

4

The Settings Sync extension should do the trick, though the UX is so-so.

It syncs your settings to a GitHub Gist in JSON format. You’ll have to create a GitHub token. I suggest saving the token code in the token file name, as when you need to download your settings again later, it’s unlikely you’ll have the code handy (at least, that was my case).

1

I just install Google Backup and Sync apps and then add user folder C:\Users\<user>\.vscode into the list of folders to be backed up.

Google Backup and Sync

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy