Skip to content

Apologies for the appearance of the site. I'm designing in public!

Screaming lego minifig wearing blue overalls sat on a white floor against a white background

Manually copying VS Code extensions

Published on Tuesday, 17 January 2023.
At 354 words, this article should take about 2 minutes to read.

The other day, I found myself needing to import my Extensions from one instance of VS Code to another.

"Why not use Settings Sync?!"

Well, one instance is my work laptop and the other is personal and I am not able to sync to a personal account from a work machine.

What I can do, is use a USB memory stick!

How do I achieve this wizardry?!

On the machine with the extensions you want to copy. For me, this is my work Mac…

code --list-extensions | xargs -L 1 echo code --install-extension >

Now, put onto a pen drive, upload to the cloud - basically get it somewhere your other machine can access it.

On your other machine - for me this is my personal laptop;

  1. Open terminal/iTerm/Warp/whatever
  2. Navigate to the folder with the file in it. This does not need to be anywhere near your VS Code installation - it could still be in your Downloads folder or whereever.
  3. Run the command bash
  4. Watch in amazement as VS COde installs each of your extensions from your old machine!

How does this work?!

If you're the kind of person who doesn't like copy-pasting bash commands into your terminal without know what they do in detail, read on!

code # The CLI for VS Code
--list-extensions # Lists the installed extensions for the instance of VS Code
| # Pipes the list as an array
xargs # Takes the piped array and creates a command from it
-L 1 # Basically tells xargs to treat line-ends as a new command
echo # The command to "write" or "print" the `code --install-extension >` text
code # See above
--install-extension # Installs the named extension
> # Indicates the preceeding text is written _into_ # The filename to be written to


While Settings Sync is probably the best way to handle the syncing of Extensions there are sometimes situations where it isn't feasible. Knowing how to do this programatically instead of making a manual list of the extension names and installing them one-by-one is a useful tool in your arsenal.

I hope this helps someone else 😎


Cover image courtesy of Hello I'm Nik.


In almost all cases, the comments section is a vile cesspool of Reply Guys, racists, and bots.

I don't want to have to deal with that kind of hell so I don't have a comments section.

If you want to continue the conversation, you can always hit me up on Mastodon (which is not a vile cesspool of Reply Guys, racists, and bots).

onward-journeys module