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
Open a new terminal after the installer finishes. Then verify the installation:
bun --version
You should see a version such as 1.3.11.
You can also install Bun through npm:
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. If the terminal says bun: command not found, check whether this directory exists:
ls ~/.bun/bin
For zsh, add Bun to ~/.zshrc:
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Restart the terminal and run bun --version again.
Update Bun
Bun can update its own executable:
bun upgrade
Use the stable release for real projects. Canary releases are useful for testing a fix, but they change on every commit and receive less testing.
Record the version used by your team and deployment environment. When a runtime bug appears, the exact version is one of the first facts you’ll need.
Lesson completed