To run VS Code portable, download the ZIP version (Windows) or TAR.GZ (Linux), extract it, and create a folder named data next to Code.exe. VS Code then keeps its settings, extensions and session state inside that folder, so you can copy or move the whole thing to a USB drive or another PC.
The steps below follow the official Portable Mode page for Visual Studio Code. Details can change between releases, so check that page if something here doesn't match what you see.
Which download supports portable mode
| OS | Download to use | Marker for portable mode |
|---|---|---|
| Windows | ZIP archive (.zip) | A data folder next to Code.exe |
| Linux | TAR.GZ | A data folder next to the code executable |
| macOS | The regular Application download | A code-portable-data folder beside the app |
On Windows, don't try this with the User or System installer. The documentation says portable mode is only supported on the ZIP archive.
Turn on portable mode on Windows
- Download the Windows ZIP from the VS Code download page and extract it to a folder, for example
D:\PortableApps\VSCode. - Inside that folder, next to
Code.exeand thebinfolder, create a new folder nameddata. - Start
Code.exe.
From that point on, VS Code reads and writes its data under data instead of your user profile. The folder holds session state, preferences and extensions. It also overrides the --user-data-dir and --extensions-dir command-line options.
Turn on portable mode on Linux
Extract the TAR.GZ and create data next to the code executable. Then give the Electron sandbox helper the permissions the documentation lists:
sudo chown root <path-to-vscode>/chrome-sandbox
sudo chmod 4755 <path-to-vscode>/chrome-sandbox
Replace <path-to-vscode> with the folder you extracted into.
Turn on portable mode on macOS
Create a folder named code-portable-data as a sibling of Visual Studio Code.app, not inside it. The layout looks like this:
Visual Studio Code.app
code-portable-data
For VS Code Insiders on macOS, the folder name is code-insiders-portable-data. If portable mode doesn't take effect, the documentation suggests removing the quarantine attribute:
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
How to check that portable mode is working
After the first launch, open the data folder in your file manager. If portable mode is active, VS Code will have created subfolders there, such as user-data and extensions. If the folder is still empty after you have changed a setting or installed an extension, VS Code is not using it. In that case, close every VS Code window and check the folder name and location again, as described in the troubleshooting section below.
A simple test is to install one small extension, close VS Code, and look inside data/extensions. If the extension's folder appears there, the setup works, and the extension is not being written to your user profile.
Move your existing settings and extensions into it
A fresh data folder starts empty, so VS Code looks like a clean install. To bring your current setup across, copy these folders. The destinations are the ones the documentation gives.
| OS | Copy this | To this |
|---|---|---|
| Windows | %APPDATA%\Code | data\user-data |
| Windows | %USERPROFILE%\.vscode\extensions | data\extensions |
| Linux | $HOME/.config/Code | data/user-data |
| Linux | ~/.vscode/extensions | data/extensions |
| macOS | $HOME/Library/Application Support/Code | code-portable-data/user-data |
| macOS | ~/.vscode/extensions | inside code-portable-data |
Close VS Code before copying so no files are locked or half written.
Keep the temp folder portable
By default the temp folder stays in the system directory. To keep it with the rest of your data, create an empty folder named tmp inside data. VS Code uses it as soon as it exists.
How to update portable VS Code
The Windows ZIP does not auto update; the setup documentation says to update it manually for each release. The process is:
- Download and extract the newer ZIP (or TAR.GZ on Linux) into a new folder.
- Copy your existing
datafolder into the new folder. - Start the new copy and delete the old folder once you've confirmed everything works.
On macOS, automatic updates work as usual. For the other ways of updating an installed copy, see how to update VS Code.
Back up a portable install
Because everything lives in one folder, a backup is just a copy of that folder. Close VS Code first, then copy the whole data folder to another location. To restore, extract a fresh ZIP and drop the saved data folder next to the executable. Keeping the data folder separate from the program files also makes updates easier, since it is the only part you need to carry over.
Limits to know about
- Only the ZIP (Windows), TAR.GZ (Linux) and Application (macOS) downloads support portable mode.
- The Windows ZIP has no auto update, so you have to remember to update it.
- Linux needs the
chrome-sandboxpermission change above. - The
datafolder is not encrypted. Anything stored in it, including settings and extension data, travels with the drive.
If portable mode doesn't work
Check that data sits directly beside Code.exe (or code), not one level up or down, and that the name is exactly data in lowercase. If VS Code still opens with your old settings, you are probably launching a different, installed copy, for example from a taskbar shortcut. Start the executable from the extracted folder instead. On macOS, try the xattr command above.
Frequently asked questions
- Can I use VS Code portable mode with the normal installer?
- No. On Windows, portable mode is only supported on the ZIP archive, not on the User or System installers. On Linux use the TAR.GZ download, and on macOS use the regular Application download with a sibling data folder.
- Does VS Code portable update itself?
- On Windows the ZIP does not auto update, so you update manually: extract the newer version and copy your data folder into it. On macOS, automatic updates work as usual.
- Where does portable VS Code keep extensions?
- In the data folder, under data/extensions on Windows and Linux. The data folder overrides the --user-data-dir and --extensions-dir command-line options, so everything stays inside it.
- How do I keep the temp folder portable too?
- Create an empty folder named tmp inside the data folder. By default the temp folder stays in the system directory, and VS Code uses the new one once it exists.