Bun Installation
This chapter introduces how to install Bun on different operating systems, as well as verification and configuration after installation.
System Requirements
Bun supports the following operating systems:
macOS / Linux Installation
Method 1: Official Installation Script (Recommended)
Open terminal and run the following command:
After installation, restart terminal or run:
Method 2: Using Homebrew (macOS)
Method 3: Using npm
If Node.js is already installed:
Method 4: Using Proto
Windows Installation
Method 1: PowerShell Installation (Recommended)
Open PowerShell as administrator:
Method 2: Using Scoop
Method 3: Using npm
Method 4: Via WSL
Use Linux installation method in WSL:
Verifying Installation
After installation, verify Bun is correctly installed:
Quick Test
Create a test file:
Run the test:
Output:
Updating Bun
Using Built-in Command
Updating to Specific Version
Updating to Latest Beta
Uninstalling Bun
macOS / Linux
Windows
Uninstall via Package Manager
Configuring Environment Variables
Adding to PATH
If the command is not found after installation, manually add PATH:
Linux/macOS (bash):
macOS (zsh):
Windows PowerShell:
Bun Configuration File
Bun uses bunfig.toml as the configuration file:
Configuration File Location
Bun searches for configuration in the following order:
./bunfig.toml(current directory)$XDG_CONFIG_HOME/bun/bunfig.toml~/.bunfig.toml
Common Installation Issues
Issue 1: Insufficient Permissions
Issue 2: Network Issues
Use mirror acceleration:
Issue 3: Command Not Found
Ensure PATH is configured correctly:
Issue 4: Windows Execution Policy
IDE Support
VS Code
Install Bun extension for better development experience:
- Open VS Code extension marketplace
- Search for "Bun"
- Install the official extension
Other IDEs
- WebStorm: Native Bun support
- Vim/Neovim: Use LSP configuration
- Sublime Text: Install related plugins
Summary
This chapter covered:
- ✅ Installing Bun on macOS, Linux, Windows
- ✅ Verifying installation and version management
- ✅ Configuring environment variables and config files
- ✅ Solving common installation issues
Next Steps
After installation, continue reading Quick Start to create your first Bun project.