pwsh.exe) instead of the default powershell.exe.
Prerequisites
Enable Scripts
By default, running unverified scripts are blocked.System Dependencies
Bun v1.1 or later. We use Bun to run it’s own code generators.- LLVM 19.1.7
- Go
- Rust
- NASM
- Perl
- Ruby
- Node.js
- Ccache
The Zig compiler is automatically downloaded, installed, and updated by the building process.
Scoop
Please do not use WinGet/other package manager for these, as you will likely install Strawberry
Perl instead of a more minimal installation of Perl. Strawberry Perl includes many other utilities
that get installed into
$Env:PATH that will conflict with MSVC and break the build.Scoop
.\scripts\vs-shell.ps1 sourced. This script is available in the Bun repository and can be loaded by executing it:
mt.exe
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\vs-shell.ps1 sourced.Building
bun-debug.exe in the build/debug folder.
$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\debug 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/debug/cache/webkit/ - Zig is extracted to
build/debug/cache/zig/bin/zig.exe
Tests
You can run the test suite either usingbun test <path> or by using the wrapper script bun node:test <path>. The bun node:test command runs every test file in a separate instance of bun.exe, to prevent a crash in the test runner from stopping the entire suite.
Troubleshooting
.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 overwritebun-debug.exe if it is already open. you likely have a running instance, maybe in the vscode debugger?