How to download and install Bun on Mac

Bun is a fast JavaScript runtime, package manager, bundler and test runner in one program, installed with one Terminal command from Bun’s official site. Here is how to install it, check it and keep it updated.

Bun

  • macOS 13 or later
  • Apple Silicon and Intel
  • Free, open source

The links go to the developer’s website (bun.com). MacWashing is not affiliated with the developer and keeps no installers.

Open Terminal (Applications › Utilities) and run:

brew install bun

Homebrew downloads the app from the developer’s server, checks the file and puts the app in Applications.

No Homebrew yet? How to install Homebrew: one command from brew.sh.

Before you start

Bun is a single program with no dependencies. It needs macOS 13 or later and runs on Apple Silicon and Intel Macs. The install script picks the right build by itself.

The command below is from Bun’s official documentation at bun.com. Bun’s site also lives at bun.sh. Don’t run install commands copied from other sites.

Install Bun with one command

  1. Open Terminal: Applications › Utilities › Terminal, or press Command-Space and type Terminal.
  2. Copy the command below, paste it into Terminal and press Return.
  3. The script downloads Bun into ~/.bun and adds ~/.bun/bin to your PATH in ~/.zshrc.
  4. Open a new Terminal window so it picks up the new PATH.
curl -fsSL https://bun.com/install | bash

Check and update Bun

In the new Terminal window, check that Bun runs:

bun --version
  • Updates. If you installed Bun with the script, update it with: bun upgrade If you installed it with Homebrew, use this instead: brew upgrade bun
  • Package cache. Bun keeps every package it downloads in a global cache in ~/.bun/install/cache, which grows with your projects.

If Bun doesn’t work

  • «command not found: bun». Open a new Terminal window. If it still fails, check that ~/.zshrc has these lines:
~/.zshrc
export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH"
  • Bun fails on an older Mac. Check your macOS version in About This Mac: Bun needs macOS 13 or later.
  • Two copies of Bun. If you installed Bun both with the script and with Homebrew, this shows which one runs: which bun Keep one of them.
  • Start over. To remove Bun installed with the script, delete the ~/.bun folder, then run the install command again.

Alternatives to Bun

Keep your Mac tidy

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

Package managers and other developer tools keep caches that grow with every project. System Junk in MacWashing finds the caches apps and developer tools build up and shows how much space they take.

Free trial · macOS 14 or later

Questions and answers

Is Bun free?

Yes. Bun is free and open source.

Should I use the script or Homebrew?

The script from bun.com is Bun’s main way. A Bun installed with it updates with: bun upgrade Homebrew installs the same Bun: brew install bun It then updates with: brew upgrade bun There is no app to download: Bun is a Terminal tool.

Can Bun replace Node.js?

Bun is designed as a drop-in replacement for Node.js, and most Node.js projects and npm packages work with it with little or no change. You can keep Node.js installed next to it.