Installation
Install Bun with npm, Homebrew, Docker, or the official script.
Overview
Bun ships as a single, dependency-free executable. Install it with the install script, a package manager, or Docker on macOS, Linux, and Windows.
Installation
curl -fsSL https://bun.sh/install | bash
powershell -c "irm bun.sh/install.ps1|iex"
For support and discussion, join the #windows channel on the Discord.
npm install -g bun # the last `npm` command you'll ever need
brew install oven-sh/bun/bun
scoop install bun
Bun provides a Docker image that supports both Linux x64 and arm64.
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
Image Variants
Bun also publishes image variants for different operating systems:
docker pull oven/bun:debian
docker pull oven/bun:slim
docker pull oven/bun:distroless
docker pull oven/bun:alpine
To check that Bun was installed successfully, open a new terminal window and run:
bun --version
# Output: 1.x.y
# See the precise commit of `oven-sh/bun` that you're using
bun --revision
# Output: 1.x.y+b7982ac13189
Add Bun to your PATH
- Determine which shell you're usingterminal
echo $SHELL # /bin/zsh or /bin/bash or /bin/fish - Open your shell configuration file
- For bash:
~/.bashrc - For zsh:
~/.zshrc - For fish:
~/.config/fish/config.fish
- For bash:
- Add the Bun directory to PATH
Add these lines to your configuration file:
terminalexport BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" - Reload your shell configurationterminal
source ~/.bashrc # or ~/.zshrc
- Determine if the bun binary is properly installedterminal
& "$env:USERPROFILE\.bun\bin\bun" --versionIf the command runs successfully but
bun --versionis not recognized, bun is not in your system's PATH. To fix this, open a PowerShell terminal and run the following command:terminal[System.Environment]::SetEnvironmentVariable( "Path", [System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin", [System.EnvironmentVariableTarget]::User ) - Restart your terminal
Restart your terminal and test with
bun --version.terminalbun --version
Upgrading
Once installed, the binary can upgrade itself:
bun upgrade
Canary Builds
Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build:
# Upgrade to latest canary
bun upgrade --canary
# Switch back to stable
bun upgrade --stable
Use a canary build to test new features and bug fixes before they reach a stable release. To help the Bun team fix bugs faster, canary builds automatically upload crash reports.
Installing Older Versions
Since Bun is a single binary, you can install older versions by re-running the installer script with a specific version.
To install a specific version, pass the git tag to the install script:
curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.3"
On Windows, pass the version number to the PowerShell install script:
iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.3.3"
Direct Downloads
To download Bun binaries directly, visit the releases page on GitHub.
Latest Version Downloads
glibc, Nehalem or newer
ARM64 Linux systems
Nehalem or newer
Windows on ARM (Snapdragon, etc.)
Apple Silicon (M1/M2/M3)
Intel Macs
Musl Binaries
For distributions without glibc (Alpine Linux, Void Linux):
CPU Requirements
Bun ships a single x64 binary per platform. It targets the Nehalem microarchitecture (SSE4.2) and selects AVX2/AVX-512 code paths at runtime when the CPU supports them, so there is no separate "baseline" download to choose.
| Platform | Intel Requirement | AMD Requirement |
|---|---|---|
| x64 | Nehalem (1st gen Core) or newer | Bulldozer or newer |
Uninstall
To remove Bun from your system:
rm -rf ~/.bun
powershell -c ~\.bun\uninstall.ps1
npm uninstall -g bun
brew uninstall bun
scoop uninstall bun