本页还没有译文
本页 52 段还没译成한국어,下面显示的是英文原文。Installation
还没翻译译自英文(bun.com)本页 52 段都还没译
Overview
Bun ships as a single, dependency-free executable. Install it with the install script, a package manager, or Docker on macOS, Linux, and Windows.
Tip
After installation, verify with bun --version and bun --revision.
Installation
macOS & LinuxWindowsPackage ManagersDocker
curl
curl -fsSL https://bun.com/install | bashNote
Linux users: You need the unzip package to install Bun (sudo apt install unzip). We recommend kernel version 5.6 or higher. Bun runs on kernels as old as 3.10 (RHEL 7) with graceful degradation of newer syscalls. Use uname -r to check your kernel version.
PowerShell
powershell -c "irm bun.sh/install.ps1|iex"Warning
Bun requires Windows 10 version 1809 or later.
For support and discussion, join the #windows channel on the Discord.
npmHomebrewScoop
npm install -g bun # the last `npm` command you'll ever needbrew install oven-sh/bun/bunscoop install bunBun provides a Docker image that supports both Linux x64 and arm64.
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bunImage Variants
Bun also publishes image variants for different operating systems:
docker pull oven/bun:debian
docker pull oven/bun:slim
docker pull oven/bun:distroless
docker pull oven/bun:alpineTo check that Bun was installed successfully, open a new terminal window and run:
bun --version
# Output: 1.x.y
# See the precise commit of `oven-sh/bun` that you're using
bun --revision
# Output: 1.x.y+b7982ac13189Warning
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 & LinuxWindows
-
Determine which shell you're using
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
- For bash:
-
Add the Bun directory to PATH
Add these lines to your configuration file:
export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" -
Reload your shell configuration
source ~/.bashrc # or ~/.zshrc
-
Determine if the bun binary is properly installed
& "$env:USERPROFILE\.bun\bin\bun" --versionIf the command runs successfully but
bun --versionis not recognized, bun is not in your system's PATH. To fix this, open a PowerShell terminal and run the following command:[System.Environment]::SetEnvironmentVariable( "Path", [System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin", [System.EnvironmentVariableTarget]::User ) -
Restart your terminal
Restart your terminal and test with
bun --version.bun --version
Upgrading
Once installed, the binary can upgrade itself:
bun upgradeTip
Homebrew users
To avoid conflicts with Homebrew, use brew upgrade bun instead.
Scoop users
To avoid conflicts with Scoop, use scoop update bun instead.
Canary Builds
Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build:
# Upgrade to latest canary
bun upgrade --canary
# Switch back to stable
bun upgrade --stableUse a canary build to test new features and bug fixes before they reach a stable release. To help the Bun team fix bugs faster, canary builds automatically upload crash reports.
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 & macOSWindows
To install a specific version, pass the git tag to the install script:
curl -fsSL https://bun.com/install | bash -s "bun-v1.3.3"On Windows, pass the version number to the PowerShell install script:
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
glibc, Nehalem or newer
ARM64 Linux systems
Nehalem or newer
Windows on ARM (Snapdragon, etc.)
Apple Silicon (M1/M2/M3)
Intel Macs
Musl Binaries
For distributions without glibc (Alpine Linux, Void Linux):
Note
Bun's glibc binaries require glibc 2.17 or newer. If you encounter an error like bun: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_... not found, try using the musl binary. Bun's install script
automatically chooses the correct binary for your system.
CPU Requirements
Bun ships a single x64 binary per platform. It targets the Nehalem microarchitecture (SSE4.2) and selects AVX2/AVX-512 code paths at runtime when the CPU supports them, so there is no separate "baseline" download to choose.
| Platform | Intel Requirement | AMD Requirement |
|---|---|---|
| x64 | Nehalem (1st gen Core) or newer | Bulldozer or newer |
Note
Bun does not support x64 CPUs without the SSE4.2 extension. Bun requires macOS 13.0 or later. The -baseline release
assets and @oven/bun-*-x64-baseline npm packages are kept as aliases of the single x64 binary for backward
compatibility with older install scripts.
Uninstall
To remove Bun from your system:
macOS & LinuxWindowsPackage Managers
rm -rf ~/.bunpowershell -c ~\.bun\uninstall.ps1npmHomebrewScoop
npm uninstall -g bunbrew uninstall bunscoop uninstall bun