How to Install and Manage VS Code Extensions from the Command Line

Install, uninstall, list, and update VS Code extensions from the terminal using the code command. Automate extension setup across machines without opening the Extensions view.

4 min read

You can install, uninstall, list, update, and disable VS Code extensions entirely from the terminal using the code command. No need to open the Extensions view or click through the Marketplace UI.

If you have not set up the code command yet, see the VS Code command line interface guide. For managing extensions through the UI instead of the terminal, use the Extensions view.

Install an extension

Use the --install-extension flag followed by the full extension identifier in the format publisher.extension.

bashbash
code --install-extension esbenp.prettier-vscode

VS Code downloads the extension from the Marketplace and installs it. You see the installation progress in the terminal. The extension activates the next time you open VS Code or immediately if VS Code is already running.

To install a specific version, append the version number. To install from a local VSIX file instead of the Marketplace, provide the file path. To skip any confirmation prompts, add --force:

bashbash
# Install a specific version
code --install-extension ms-python.python@2024.0.0
 
# Install from a local VSIX file
code --install-extension ~/downloads/custom-theme.vsix
 
# Skip confirmation prompts
code --install-extension esbenp.prettier-vscode --force

See how to install a VS Code extension from a VSIX file for VSIX-specific safety guidance.

Install an extension for a specific profile

Extensions can be scoped to a single VS Code profile using the --profile flag.

bashbash
code --install-extension ms-python.python --profile "Python Dev"

The extension installs only in the named profile. It does not appear in other profiles or the Default Profile.

Use the exact profile name shown in the Profiles menu.

Uninstall an extension

Remove an extension with --uninstall-extension. Provide the full publisher.extension identifier, just like you did when installing it. VS Code deactivates and removes the extension immediately:

bashbash
code --uninstall-extension esbenp.prettier-vscode

VS Code removes the extension immediately. If VS Code is running, the extension is deactivated.

To target a specific profile, add the --profile flag:

bashbash
code --uninstall-extension ms-python.python --profile "Python Dev"

List installed extensions

See every extension you have installed with --list-extensions. Redirect the output to a file to save your list, or add --show-versions to include version numbers:

bashbash
# Save extension list to a file
code --list-extensions > my-extensions.txt
 
# List with version numbers
code --list-extensions --show-versions

This is useful for sharing your setup with a team or scripting an automated install on a new machine.

Filter by profile

List extensions for a specific profile:

bashbash
code --list-extensions --profile "Python Dev"

This shows only the extensions installed in that profile, not your global extensions.

Update all extensions

Update every installed extension to the latest version with one command:

bashbash
code --update-extensions

VS Code checks each extension against the Marketplace and downloads newer versions. This command exits after the update completes. It is ideal for keeping a CI environment or a shared machine up to date automatically.

Disable all extensions temporarily

If you need to launch VS Code without any extensions active, use --disable-extensions:

bashbash
code --disable-extensions .

Extensions remain installed and appear in the Disabled section of the Extensions view, but none are activated. This is useful for troubleshooting performance issues or extension conflicts. Close the window and reopen normally to restore extensions.

Automate extension setup for a team

A common workflow is to commit a list of recommended extensions to your project repository and let team members install them with a single script.

Export your current extensions

Run code --list-extensions > .vscode/extensions.txt to save your installed extensions to a file inside the project's .vscode folder.

Commit the file

Add extensions.txt to your repository. Team members who clone the project get the list automatically.

Install from the list on a new machine

Each team member runs a script that reads the file and installs every listed extension. On Linux or macOS, a one-liner handles this: cat .vscode/extensions.txt | xargs -L 1 code --install-extension.

This pairs well with an extensions.json recommendations file, which suggests extensions inside the VS Code UI instead of the terminal.

Verify that an extension installed correctly

After running --install-extension, confirm it worked by listing the extension:

bashbash
code --list-extensions | grep prettier

If the extension identifier appears in the output, it is installed. Open VS Code and check the Extensions view to confirm it is active and has no errors.

Rune AI

Rune AI

Key Insights

  • Install an extension with code --install-extension publisher.name.
  • Uninstall with code --uninstall-extension publisher.name.
  • List all installed extensions with code --list-extensions.
  • Update all extensions at once with code --update-extensions.
  • Target a specific profile with the --profile flag.
  • Export your list to a file for sharing or reinstallation on another machine.
RunePowered by Rune AI

Frequently Asked Questions

How do I install an extension for a specific VS Code profile from the command line?

Use the --profile flag with --install-extension. For example: code --install-extension esbenp.prettier-vscode --profile "Web Development". The extension is installed only in that profile.

Can I export my installed extensions as a list and reinstall them on another machine?

Yes. Run code --list-extensions > extensions.txt on the source machine to save the list. On the target machine, run each line through code --install-extension. You can automate this with a shell script that reads the file line by line.

What happens if I install an extension that is already installed?

code --install-extension updates the extension to the latest version if it is already installed. There is no separate update command needed for individual extensions.

Conclusion

The code CLI gives you full control over extensions without leaving the terminal. Install with --install-extension, uninstall with --uninstall-extension, list with --list-extensions, and update all at once with --update-extensions. This is the fastest way to set up a new machine or share your extension list with a team.