Skip to main content

Prerequisites

Before building VS Code from source, ensure you have the following installed:

Node.js

Required for running build scripts and dependencies

Git

For cloning the repository and version control

Python

Required for building native modules

C++ Compiler

Platform-specific compiler for native dependencies
Development Container Available: VS Code includes a Dev Container configuration that provides a pre-configured environment with all prerequisites. Docker needs at least 4 Cores and 8 GB of RAM (9 GB recommended).

System Requirements

  • Xcode Command Line Tools: Install with xcode-select --install
  • Node.js: Version specified in .nvmrc
  • Python: Version 3.x
  • Minimum RAM: 8 GB (16 GB recommended)

Getting the Source Code

1

Clone the Repository

Clone the VS Code repository from GitHub:
git clone https://github.com/microsoft/vscode.git
cd vscode
2

Install Dependencies

Install all npm dependencies. The postinstall script will automatically run after installation:
npm install
The postinstall script (build/npm/postinstall.ts) handles additional setup tasks automatically.
3

Download Electron

Download the Electron binary (unless skipped via environment variable):
npm run electron
This command runs node build/lib/electron.ts to download the correct Electron version.

Building VS Code

Full Compilation

Compile all TypeScript sources using Gulp:
npm run compile
This internally runs:
node --max-old-space-size=8192 ./node_modules/gulp/bin/gulp.js compile
The build process allocates up to 8 GB of heap space for Node.js. Ensure you have sufficient RAM available.

Building Specific Components

npm run compile-web

Running from Source

Launch VS Code from source:
./scripts/code.sh
The script will:
  1. Run the preLaunch task (if VSCODE_SKIP_PRELAUNCH is not set)
  2. Set development environment variables
  3. Launch Electron with VS Code
Environment variables set:
  • NODE_ENV=development
  • VSCODE_DEV=1
  • VSCODE_CLI=1
  • ELECTRON_ENABLE_STACK_DUMPING=1
  • ELECTRON_ENABLE_LOGGING=1

Running Web Version

Launch VS Code in a browser:
./scripts/code-server.sh
The web version runs on http://localhost:8080 by default.

Build Optimization

Watch Mode for Development

For active development, use watch mode to automatically recompile on file changes:
npm run watch
This runs three parallel watch tasks:
  • watch-client-transpile: Transpiles client TypeScript
  • watch-client: Watches client code
  • watch-extensions: Watches extension code

Individual Watch Tasks

npm run watch-client

Using Deemon for Process Management

Deemon provides daemon-style process management for watch tasks:
npm run watchd

Production Builds

For production-ready builds:
1

Minify VS Code

npm run minify-vscode
2

Minify Remote Extension Host

npm run minify-vscode-reh
3

Minify Remote Extension Host Web

npm run minify-vscode-reh-web

Using Development Containers

Local Development Container

1

Install Prerequisites

  • Docker Desktop (macOS/Windows) or Docker (Linux)
  • VS Code with Dev Containers extension
2

Clone in Container

Press Ctrl/Cmd + Shift + P and select:
Dev Containers: Clone Repository in Container Volume...
Enter: https://github.com/microsoft/vscode
3

Build and Run

After the container starts:
npm i
bash scripts/code.sh

GitHub Codespaces

1

Create Codespace

From the GitHub repository, click CodeOpen with CodespacesNew codespace
2

Select Machine Size

Choose Standard machine (4-core, 8GB RAM)
3

Access Desktop

The codespace provides a VNC-based desktop environment:
The development container uses Fluxbox window manager. Right-click on the desktop to see menu options.

Troubleshooting

Build Failures

Increase Node.js heap size:
export NODE_OPTIONS="--max-old-space-size=8192"
Ensure you have the correct C++ compiler:
  • macOS: Install Xcode Command Line Tools
  • Linux: Install build-essential
  • Windows: Install Visual Studio with C++ workload
Set the Electron mirror if you’re behind a firewall:
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
Use WSL on Windows or the Dev Container approach for better I/O performance:
# Use container volume instead of local filesystem
Dev Containers: Clone Repository in Container Volume...

Clean Build

If you encounter persistent issues, perform a clean build:
# Remove node_modules and compiled output
rm -rf node_modules out

# Reinstall dependencies
npm install

# Rebuild
npm run compile

Next Steps

Development Workflow

Learn about the development workflow and tools

Debugging

Set up debugging for VS Code development

Running Tests

Learn how to run and write tests

Contributing

Read the contribution guidelines