Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called bun
.
Bun ships as a single executable that can be installed a few different ways.
Installing
macOS and Linux
curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
# to install a specific version
curl -fsSL https://bun.sh/install | bash -s " bun-v1.0.0 "
npm install -g bun # the last `npm` command you'll ever need
brew install oven-sh/bun/bun # for macOS and Linux
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
Windows
Bun requires a minimum of Windows 10 version 1809
Bun provides a limited, experimental native build for Windows. It is recommended to use Bun within Windows Subsystem for Linux and follow the above instructions. To help catch bugs, the experimental build enables many debugging assertions, which will make the binary slower than what the stable version will be.
To install, paste this into a terminal:
# WARNING: No stability is guaranteed on the experimental Windows builds
powershell -c " irm bun.sh/install.ps1|iex "
# WARNING: No stability is guaranteed on the experimental Windows builds
scoop bucket add versions
Checking Installation
To check that Bun was installed successfully, open a new terminal window and run bun --version
.
To see the precise commit of oven-sh/bun that you’re using, run bun --revision
.
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
.
How to add your PATH
First, determine what shell you’re using:
/bin/zsh # or /bin/bash or /bin/fish
Then add these lines below to bottom of your shell’s configuration file.
export BUN_INSTALL = " $HOME /.bun "
export PATH = " $BUN_INSTALL /bin: $PATH "
export BUN_INSTALL = " $HOME /.bun "
export PATH = " $BUN_INSTALL /bin: $PATH "
# add to ~/.config/fish/config.fish
export BUN_INSTALL = " $HOME /.bun "
export PATH = " $BUN_INSTALL /bin: $PATH "
Save the file. You’ll need to open a new shell/terminal window for the changes to take effect.
Upgrading
Once installed, the binary can upgrade itself.
Homebrew users — To avoid conflicts with Homebrew, use brew upgrade bun instead.
proto users - Use proto install bun --pin instead.
Bun automatically releases an (untested) canary build on every commit to main
. To upgrade to the latest canary build:
View canary build
Uninstall
If you need to remove Bun from your system, use the following commands.
rm -rf ~/.bun # for macOS, Linux, and WSL
Remove-Item ~ \. bun -Recurse