Skip to content

Overview

Bun ships as a single, dependency-free executable. You can install it via script, package manager, or Docker across macOS, Linux, and Windows.

Warning

After installation, verify with bun --version and bun --revision.

Installation

macOS & Linux

bash
curl -fsSL https://bun.com/install | bash

Warning

Linux users  The unzip package is required to install Bun. Use sudo apt install unzip to install the unzip package. Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Use uname -r to check Kernel version.

Windows

powershell
powershell -c "irm bun.sh/install.ps1|iex"

WARNING

  Bun requires Windows 10 version 1809 or later.

For support and discussion, please join the #windows channel on our Discord.

Package Managers

bash
npm install -g bun # the last `npm` command you'll ever need
bash
brew install oven-sh/bun/bun
bash
scoop install bun

Docker

Bun provides a Docker image that supports both Linux x64 and arm64.

bash
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

Image Variants

There are also image variants for different operating systems:

bash
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:

bash
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

WARNING

If you've installed Bun but are seeing a command not found error, you may have to manually add the installation directory (~/.bun/bin) to your PATH.

Add Bun to your PATH

macOS & Linux

bash
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

Add the Bun directory to PATH

Add this line to your configuration file:

bash
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"

Reload your shell configuration

bash
source ~/.bashrc  # or ~/.zshrc

Windows

bash
        ```bash
        & "$env:USERPROFILE\.bun\bin\bun" --version
        ```

        If the command runs successfully but `bun --version` is not recognized, it means that bun is not in your system's PATH. To fix this, open a Powershell terminal and run the following command:

        ```bash
        [System.Environment]::SetEnvironmentVariable(
          "Path",
          [System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin",
          [System.EnvironmentVariableTarget]::User
        )
        ```

#### Restart your terminal
After running the command, restart your terminal and test with `bun --version`

```bash
bun --version

Upgrading

Once installed, the binary can upgrade itself:

bash
bun upgrade

Canary Builds

-> View canary build

Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build:

bash
# Upgrade to latest canary
bun upgrade --canary

# Switch back to stable
bun upgrade --stable

The canary build is useful for testing new features and bug fixes before they're released in a stable build. To help the Bun team fix bugs faster, canary builds automatically upload crash reports to Bun's team.


Installing Older Versions

Since Bun is a single binary, you can install older versions by re-running the installer script with a specific version.

####Linux & macOS"> To install a specific version, pass the git tag to the install script:

```bash
curl -fsSL https://bun.com/install | bash -s "bun-v1.3.3"
```

####Windows"> On Windows, pass the version number to the PowerShell install script:

```powershell PowerShell icon="windows"
iex "& {$(irm https://bun.com/install.ps1)} -Version 1.3.3"
```

Direct Downloads

To download Bun binaries directly, visit the releases page on GitHub.

Latest Version Downloads

Musl Binaries

For distributions without glibc (Alpine Linux, Void Linux):

TIP

If you encounter an error like bun: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.29 not found, try using the musl binary. Bun's install script automatically chooses the correct binary for your system.


CPU Requirements

Bun has specific CPU requirements based on the binary you're using:

Standard Builds

x64 binaries target the Haswell CPU architecture (AVX and AVX2 instructions required)

PlatformIntel RequirementAMD Requirement
x64Haswell (4th gen Core) or newerExcavator or newer

Baseline Builds

x64-baseline binaries target the Nehalem architecture for older CPUs

PlatformIntel RequirementAMD Requirement
x64-baselineNehalem (1st gen Core) or newerBulldozer or newer

WARNING

Baseline builds are slower than regular builds. Use them only if you encounter an "Illegal Instruction" error.

::: note Bun does not support CPUs older than the baseline target, which mandates the SSE4.2 extension. macOS requires version 13.0 or later. :::

Uninstall

To remove Bun from your system:

macOS & Linux

bash
rm -rf ~/.bun

Windows

powershell
powershell -c ~\.bun\uninstall.ps1

Package Managers

bash
npm uninstall -g bun
bash
brew uninstall bun
bash
scoop uninstall bun

Released under the MIT License.