Building Windows

This document describes the build process for Windows. If you run into problems, please join the #windows channel on our Discord for help.

It is strongly recommended to use PowerShell 7 (pwsh.exe) instead of the default powershell.exe.


Enable Scripts

By default, running unverified scripts are blocked.

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted

System Dependencies

  • Bun 1.1 or later. We use Bun to run it's own code generators.
irm bun.sh/install.ps1 | iex
  • Visual Studio with the "Desktop Development with C++" workload.
    • Install Git and CMake from this installer, if not already installed.

After Visual Studio, you need the following:

  • LLVM 16
  • Go
  • Rust
  • NASM
  • Perl
  • Ruby
  • Node.js

The Zig compiler is automatically downloaded, installed, and updated by the building process.

Scoop can be used to install these remaining tools easily:

irm https://get.scoop.sh | iex

scoop install nodejs-lts go rust nasm ruby perl
scoop llvm@16.0.4 # scoop bug if you install llvm and the rest at the same time

If you intend on building WebKit locally (optional), you should install these packages:

scoop install make cygwin python

From here on out, it is expected you use a PowerShell Terminal with .\scripts\env.ps1 sourced. This script is available in the Bun repository and can be loaded by executing it:


To verify, you can check for an MSVC-only command line such as mt.exe

Get-Command mt

It is not recommended to install ninja / cmake into your global path, because you may run into a situation where you try to build bun without .\scripts\env.ps1 sourced.


bun install

.\scripts\update-submodules.ps1 # this syncs git submodule state
.\scripts\all-dependencies.ps1 # this builds all dependencies
.\scripts\make-old-js.ps1 # runs some old code generators

# Configure build environment
cmake -Bbuild -GNinja -DCMAKE_BUILD_TYPE=Debug

# Build bun
ninja -Cbuild

If this was successful, you should have a bun-debug.exe in the build folder.

.\build\bun-debug.exe --revision

You should add this to $Env:PATH. The simplest way to do so is to open the start menu, type "Path", and then navigate the environment variables menu to add C:\.....\bun\build to the user environment variable PATH. You should then restart your editor (if it does not update still, log out and log back in).

Extra paths

  • WebKit is extracted to build/bun-webkit
  • Zig is extracted to .cache/zig/zig.exe


You can run the test suite either using bun test, or by using the wrapper script packages\bun-internal-test. The internal test package is a wrapper cli to run every test file in a separate instance of bun.exe, to prevent a crash in the test runner from stopping the entire suite.

# Setup
bun i --cwd packages\bun-internal-test

# Run the entire test suite with reporter
# the package.json script "test" uses "build/bun-debug.exe" by default
bun run test

# Run an individual test file:
bun-debug test node\fs
bun-debug test "C:\bun\test\js\bun\resolve\import-meta.test.js"


.rc file fails to build

llvm-rc.exe is odd. don't use it. use rc.exe, to do this make sure you are in a visual studio dev terminal, check rc /? to ensure it is Microsoft Resource Compiler

failed to write output 'bun-debug.exe': permission denied

you cannot overwrite bun-debug.exe if it is already open. you likely have a running instance, maybe in the vscode debugger?