144

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
  • Just like other cross-platform editors, simply copy the .vscode directory to the new user environment's home directory.
    – JW0914
    Feb 7, 2020 at 13:17
  • 1
    You may be able to use the new preview feature Settings Sync to accomplish what you are trying to do. It will let you use a GitHub account or Microsoft account to store your VS Code settings (including preferences, extensions, etc) across machines. Jun 4, 2021 at 18:42

4 Answers 4

98

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
  • 1
    Settings Sync extension worked like charm, just exported my settings from OS X to Linux Mint.
    – vikas027
    Aug 9, 2017 at 11:20
  • 21
    I don't want to Sync! I want to backup! You did not properly answer the original question. Dec 8, 2017 at 1:51
  • 1
    Note that Settings Sync does not seem to backup WSL remote extensions if using remote connection
    – Mr Fox
    Jul 13, 2020 at 12:13
49

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
  • Tried, got this error message: "xargs : The term 'xargs' is not recognized as the name of a cmdlet, function, script file, or operable program." ? Jul 15, 2019 at 18:44
  • 7
    @NicholasPetersen That's for Linux. On windows: get-content c:\exportedlist.txt | % { code --install-extension $_ } Oct 18, 2019 at 21:06
  • Here is how to uninstall only exts missing from the file: code --list-extensions | diff - vs_code_extensions_list.txt | grep '^<' | sed 's/</code --uninstall-extension' | eval. Then install: code --list-extensions | diff - vs_code_extensions_list.txt | grep '^>' | sed 's/>/code --install-extension' | eval.
    – DUzun
    Mar 20, 2021 at 23:12
14

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
  • If you know you will need your GitHub token for the Settings Sync extension, you can get it from the token key in the syncLocalSettings.json that is in your Code profile, in the same folder as settings.json. Sep 12, 2019 at 8:47
-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
  • this doesn't backup the settings but just the installed extensions which can easily be reinstalled if you get the list like mentioned in other comments Nov 15, 2021 at 4:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .