How to Install Bun
Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.
Installation Methods
Global NPM Installation
npm install -g bun
Direct Installation (Unix-like Systems)
curl -fsSL https://bun.sh/install | bash
Windows Installation
Currently, Bun has experimental Windows support. For the best experience:
- Install Windows Subsystem for Linux (WSL)
- Install Bun within WSL using the curl command above
Verifying Installation
After installation, verify Bun is properly installed:
bun --version
Getting Started
-
Initialize a new project:
bun init
-
Run a JavaScript file:
bun run index.js
-
Install dependencies:
bun install