Installation - BunDocumentation Index Search...⌘KInstall Bun Search...Navigation Get Started InstallationRuntimePackage ManagerBundlerTest RunnerGuidesReferenceBlogFeedback:first-child]:!hidden peer-[.is-custom]:[&>:first-child]:sm:!hidden peer-[.is-custom]:[&>:first-child]:md:!hidden peer-[.is-custom]:[&>:first-child]:lg:!hidden peer-[.is-custom]:[&>:first-child]:xl:!hidden">Get StartedWelcome to BunInstallationQuickstartTypeScriptTypeScript 6 and 7bun initbun createCore RuntimeBun RuntimeWatch ModeDebuggingREPLbunfig.tomlFile & Module SystemFile TypesModule ResolutionJSXAuto-installPluginsFile System RouterHTTP serverServerRoutingCookiesTLSError HandlingMetricsNetworkingFetchWebSocketsTCPUDPDNSData & StorageCookiesFile I/OStreamsBinary DataArchiveSQLSQLiteS3RedisConcurrencyWorkersProcess & SystemEnvironment VariablesShellSpawnWebViewCronInterop & ToolingNode-APIFFIC CompilerTranspilerUtilitiesCSRF ProtectionSecretsConsoleTOMLYAMLMarkdownJSON5JSONLHTMLRewriterImageHashingGlobSemverColorUtilsStandards & CompatibilityGlobalsBun APIsWeb APIsNode.js CompatibilityContributingRoadmapBenchmarkingContributingBuilding WindowsBindgenLicense On this pageOverviewInstallationUpgradingCanary BuildsInstalling Older VersionsDirect DownloadsLatest Version DownloadsMusl BinariesCPU RequirementsUninstallGet StartedInstallation Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_n4ctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> *]:[overflow-wrap:anywhere]"> Copy pagespan]:line-clamp-1 overflow-hidden group flex items-center py-0.5 gap-1 text-sm text-gray-950/50 dark:text-white/50 group-hover:text-gray-950/70 dark:group-hover:text-white/70 rounded-none rounded-r-xl border px-3 border-gray-200 aspect-square dark:border-white/[0.07] bg-background-light dark:bg-background-dark hover:bg-gray-600/5 dark:hover:bg-gray-200/5" aria-label="More actions" type="button" id="radix-_R_1cctdbsnlht5lebsnpfdb_" aria-haspopup="menu" aria-expanded="false" data-state="closed"> Overview
Bun ships as a single, dependency-free executable. You can install it via script, package manager, or Docker across macOS, Linux, and Windows.
After installation, verify with bun --version and bun --revision.
Installation
macOS & Linux Windows Package Managers Docker:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0" data-component-part="tab-content">curl Linux users The unzip package is required to install Bun. Use sudo apt install unzip to install the unzip package. Kernel version 5.6 or higher is recommended; 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.:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">PowerShell Bun requires Windows 10 version 1809 or later.For support and discussion, please join the #windows channel on our Discord.:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">npmHomebrewScoop 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.
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 -> View canary build Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build: terminal svg]:size-6" data-component-part="card-icon">Linux x64Standard Linux x64 binary svg]:size-6" data-component-part="card-icon">Linux x64 BaselineFor older CPUs without AVX2 svg]:size-6" data-component-part="card-icon">Windows x64Standard Windows binary svg]:size-6" data-component-part="card-icon">Windows x64 BaselineFor older CPUs without AVX2 svg]:size-6" data-component-part="card-icon">Windows ARM64Windows on ARM (Snapdragon, etc.) svg]:size-6" data-component-part="card-icon">macOS ARM64Apple Silicon (M1/M2/M3) svg]:size-6" data-component-part="card-icon">macOS x64Intel Macs svg]:size-6" data-component-part="card-icon">Linux ARM64ARM64 Linux systems
Musl Binaries
For distributions without glibc (Alpine Linux, Void Linux):
Linux x64 musl
Linux x64 musl baseline
Linux ARM64 musl
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 has specific CPU requirements based on the binary you’re using:
Standard Builds Baseline Builds:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0" data-component-part="tab-content">x64 binaries target the Haswell CPU architecture (AVX and AVX2 instructions required)PlatformIntel RequirementAMD Requirementx64Haswell (4th gen Core) or newerExcavator or newer:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">x64-baseline binaries target the Nehalem architecture for older CPUsPlatformIntel RequirementAMD Requirementx64-baselineNehalem (1st gen Core) or newerBulldozer or newer Baseline builds are slower than regular builds. Use them only if you encounter an “Illegal
Instruction” error.
Bun does not support CPUs older than the baseline target, which mandates the SSE4.2 extension. macOS requires version
13.0 or later.
Uninstall
To remove Bun from your system:
macOS & Linux Windows Package Managers:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0" data-component-part="tab-content">terminal Yes NoSuggest editsRaise issueWelcome to BunPreviousQuickstartNext⌘I xgithubdiscordyoutubePowered byThis documentation is built and hosted on Mintlify, a developer documentation platform
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Skip to main contentBun home pageInstall Bun with npm, Homebrew, Docker, or the official script.
curl -fsSL https://bun.com/install | bash
powershell -c "irm bun.sh/install.ps1|iex"
npm install -g bun # the last `npm` command you'll ever need:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">Bun provides a Docker image that supports both Linux x64 and arm64.Docker
docker pull oven/bun docker run --rm --init --ulimit memlock=-1:-1 oven/bunImage VariantsThere are also image variants for different operating systems:Docker
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: terminal
bun --version # Output: 1.x.y # See the precise commit of `oven-sh/bun` that you're using bun --revision # Output: 1.x.y+b7982ac13189
Add Bun to your PATH
macOS & Linux Windows:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0" data-component-part="tab-content">1Determine which shell you're using
terminalecho $SHELL # /bin/zsh or /bin/bash or /bin/fish2
Open your shell configuration file
For bash: ~/.bashrc For zsh: ~/.zshrc For fish: ~/.config/fish/config.fish 3Add the Bun directory to PATH
Add this line to your configuration file:terminalexport BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH"4
Reload your shell configuration
terminalsource ~/.bashrc # or ~/.zshrc:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">1
Determine if the bun binary is properly installed
terminal& "$env:USERPROFILE\.bun\bin\bun" --versionIf the command runs successfully but bun --version is not recognized, it means that bun is not in your system’s PATH. To fix this, open a Powershell terminal and run the following command:terminal
[System.Environment]::SetEnvironmentVariable(
"Path",
[System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin",
[System.EnvironmentVariableTarget]::User
)
2Restart your terminal
After running the command, restart your terminal and test with bun --versionterminalbun --versionUpgrading Once installed, the binary can upgrade itself: terminal
bun upgrade
To avoid conflicts with Homebrew, use brew upgrade bun instead.Scoop users
To avoid conflicts with Scoop, use scoop update bun instead. Canary Builds -> View canary build Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build: terminal
# Upgrade to latest canary bun upgrade --canary # Switch back to stable bun upgrade --stableThe canary build is useful for testing new features and bug fixes before they’re released in a stable build. To help the Bun team fix bugs faster, canary builds automatically upload crash reports to Bun’s team. 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 & macOS Windows:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0" data-component-part="tab-content">To install a specific version, pass the git tag to the install script:terminal
curl -fsSL https://bun.com/install | bash -s "bun-v1.3.3":first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">On Windows, pass the version number to the PowerShell install script:PowerShell
iex "& {$(irm https:http://bun.com/install.ps1)} -Version 1.3.3"
Direct Downloads
To download Bun binaries directly, visit the releases page on GitHub.
Latest Version Downloads
rm -rf ~/.bun:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">PowerShell
powershell -c ~\.bun\uninstall.ps1:first-child:not(p)]:mt-0 [&>:first-child:not(p)_img]:mt-0 [&>:first-child[data-table-wrapper]]:!pt-0 hidden" data-component-part="tab-content">npmHomebrewScoop
npm uninstall -g bun
Was this page helpful?
Installation - Bun,AI智能索引,全网链接索引,智能导航,网页索引
- Install Bun with npm, Homebrew, Docker, or the official script.