bun is not just a package manager: it is a full JavaScript runtime that aims to replace Node, npm, and several auxiliary tools (bundler, test runner) in a single binary written in Zig.
What bun does in a single tool
| Feature | bun | Separate equivalent |
|---|---|---|
| JavaScript runtime | yes | Node.js |
| Package manager | yes | npm / pnpm |
| Bundler | yes | Vite / esbuild / Rollup |
| Test runner | yes | Vitest / Jest |
| TypeScript transpiler | native | tsc / ts-node |
The result: fewer dependencies, less configuration, and execution speed often faster than Node.
Installing bun
On macOS and Linux:
On Windows (PowerShell):
Via npm (alternative):
Verify the installation:
Common commands
Install dependencies for an existing project:
Add a package:
Add a devDependency:
Run a script:
Execute a file directly (without node):
Run tests:
Run a one-off command:
Remove a package:
Why bun is so fast
bun is written in Zig, a low-level language with no garbage collector. It uses the JavaScriptCore engine (the engine behind Safari), known for fast startup. Its package installation is aggressively parallelized and uses its own binary cache format (bun.lockb).
On public benchmarks, bun installs dependencies 5 to 20 times faster than npm, and 2 to 5 times faster than pnpm.
The bun lockfile
bun generates a bun.lockb file (binary format, not human-readable). If you need to inspect the pinned versions, use:
Compatibility
bun is compatible with the npm ecosystem at ~95%. Most packages work without modification. Remaining edge cases: some native packages (.node bindings) and tools very specific to Node. In 2026, compatibility improves with every release.