How to Install Bun on macOS, Windows, and Linux
Bun is a modern JavaScript runtime that promises high performance and streamlined tooling for web development. Installing Bun on your system is straightforward, and this guide will walk you through the steps for installing it on macOS, Windows, and Linux. Follow the steps for your operating system, and start building applications with Bun in no time.
Installation Overview
Bun’s installation can be done with a single command across various platforms. Depending on your system, the installation command may differ slightly. Let's explore each operating system in detail.
Installation on macOS
For macOS users, installing Bun is quick and simple using curl
:
-
Open Terminal: Press
Command + Space
, type "Terminal," and open it. -
Run the Installation Command: Paste the following command in the Terminal and press
Enter
. -
Add Bun to Your Path: After installation, ensure Bun is available globally by adding it to your path. This step may be prompted automatically.
-
Verify Installation: Check that Bun was installed successfully by running:
You should see Bun’s version number, confirming the installation.
Installation on Windows
For Windows, you can install Bun using the Windows Subsystem for Linux (WSL) or using PowerShell with a curl
command.
Method 1: Installing Bun via WSL (Recommended)
-
Install WSL: If you haven’t already, install WSL with the following PowerShell command (run as Administrator):
Restart your computer after WSL is installed, then open Ubuntu or your preferred Linux distribution.
-
Run the Installation Command: In the WSL Terminal, run:
-
Add Bun to Your Path:
-
Verify Installation:
Method 2: Installing Bun via PowerShell (Direct)
If you don’t want to use WSL, you can try installing directly via PowerShell:
-
Run PowerShell as Administrator.
-
Download and Install Bun:
-
Restart PowerShell and verify the installation with:
Installation on Linux
On Linux, you can install Bun with a single curl
command.
-
Open Terminal.
-
Run the Installation Command:
-
Add Bun to Your Path: After installation, make sure Bun is added to your system’s PATH by adding this line to
.bashrc
or.zshrc
: -
Verify Installation:
Additional Platforms and Advanced Options
Bun provides additional options for specific package managers, such as Homebrew on macOS, Scoop for Windows, or Snap on Linux. For detailed instructions, refer to the Bun documentation.
Installing Bun with Homebrew (macOS and Linux)
If you use Homebrew, you can install Bun with:
Installing Bun with Scoop (Windows)
For Windows users who prefer Scoop, use:
After installation, verify Bun’s availability by running:
Summary
Bun is a fast and modern JavaScript runtime that’s easy to install across different platforms:
- macOS: Use
curl
or Homebrew for installation. - Windows: Install via WSL, PowerShell, or Scoop.
- Linux: Use
curl
or Snap for direct installation.
Each installation method provides a quick way to start using Bun, allowing developers to enjoy its performance and integrated tooling in any environment.