Bun foundations
Install and update Bun
Install the stable Bun release, verify the executable, and keep it updated without losing track of the version.
Let’s install the stable version of Bun.
On macOS or Linux, run the official installer:
curl -fsSL https://bun.com/install | bash
The script downloads the executable into ~/.bun/bin and tries to add that directory to your shell configuration. Open a new terminal after it finishes, then verify the installation:
bun --version
You should see a version such as 1.3.11. If you see a number, Bun is installed and on your PATH. That’s all you need.
You can also install Bun through npm, which is handy on a machine that already has Node.js:
npm install -g bun
On Windows, run the official PowerShell installer:
powershell -c "irm bun.sh/install.ps1|iex"
Bun supports Windows 10 version 1809 and newer.
If the command is missing
The installer normally adds Bun to your PATH. Sometimes it can’t, for example when your shell uses a configuration file it doesn’t recognize. The terminal then says bun: command not found.
First, check whether the executable exists:
ls ~/.bun/bin
If you see bun listed, the problem is only the PATH. For zsh, add these two lines to ~/.zshrc (for bash, use ~/.bashrc):
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Restart the terminal and run bun --version again. If the directory is empty, the installer failed. Run it again and read its output.
Update Bun
Bun can update its own executable:
bun upgrade
It downloads the latest stable release and replaces the current one. If you installed Bun with Homebrew or npm, update it through that tool instead, so you don’t end up with two copies that drift apart.
Use the stable release for real projects. Canary releases are useful when you need a fix that hasn’t shipped yet, but they change on every commit and receive less testing. I keep canary out of anything I deploy.
One more habit. Record the Bun version your team and your deployment use, in the README or in the CI configuration. When a runtime bug appears, the exact version is one of the first facts you’ll need, and “whatever was latest that day” is not an answer.
Lesson completed