bun-types 1.3.2-canary.20251106T140813 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.d.ts +102 -6
- package/docs/bundler/bytecode.mdx +465 -0
- package/docs/bundler/css.mdx +1024 -0
- package/docs/bundler/esbuild.mdx +253 -0
- package/docs/bundler/executables.mdx +535 -0
- package/docs/bundler/fullstack.mdx +1064 -0
- package/docs/bundler/hot-reloading.mdx +229 -0
- package/docs/bundler/html-static.mdx +386 -0
- package/docs/bundler/index.mdx +1499 -0
- package/docs/bundler/loaders.mdx +356 -0
- package/docs/bundler/macros.mdx +328 -0
- package/docs/bundler/minifier.mdx +1306 -0
- package/docs/bundler/plugins.mdx +411 -0
- package/docs/feedback.mdx +85 -0
- package/docs/guides/binary/arraybuffer-to-array.mdx +29 -0
- package/docs/guides/binary/arraybuffer-to-blob.mdx +26 -0
- package/docs/guides/binary/arraybuffer-to-buffer.mdx +27 -0
- package/docs/guides/binary/arraybuffer-to-string.mdx +17 -0
- package/docs/guides/binary/arraybuffer-to-typedarray.mdx +41 -0
- package/docs/guides/binary/blob-to-arraybuffer.mdx +16 -0
- package/docs/guides/binary/blob-to-dataview.mdx +16 -0
- package/docs/guides/binary/blob-to-stream.mdx +16 -0
- package/docs/guides/binary/blob-to-string.mdx +17 -0
- package/docs/guides/binary/blob-to-typedarray.mdx +16 -0
- package/docs/guides/binary/buffer-to-arraybuffer.mdx +16 -0
- package/docs/guides/binary/buffer-to-blob.mdx +16 -0
- package/docs/guides/binary/buffer-to-readablestream.mdx +43 -0
- package/docs/guides/binary/buffer-to-string.mdx +27 -0
- package/docs/guides/binary/buffer-to-typedarray.mdx +16 -0
- package/docs/guides/binary/dataview-to-string.mdx +17 -0
- package/docs/guides/binary/typedarray-to-arraybuffer.mdx +27 -0
- package/docs/guides/binary/typedarray-to-blob.mdx +18 -0
- package/docs/guides/binary/typedarray-to-buffer.mdx +16 -0
- package/docs/guides/binary/typedarray-to-dataview.mdx +16 -0
- package/docs/guides/binary/typedarray-to-readablestream.mdx +43 -0
- package/docs/guides/binary/typedarray-to-string.mdx +18 -0
- package/docs/guides/deployment/aws-lambda.mdx +204 -0
- package/docs/guides/deployment/digital-ocean.mdx +161 -0
- package/docs/guides/deployment/google-cloud-run.mdx +197 -0
- package/docs/guides/deployment/railway.mdx +145 -0
- package/docs/guides/deployment/render.mdx +82 -0
- package/docs/guides/deployment/vercel.mdx +99 -0
- package/docs/guides/ecosystem/astro.mdx +82 -0
- package/docs/guides/ecosystem/discordjs.mdx +80 -0
- package/docs/guides/ecosystem/docker.mdx +151 -0
- package/docs/guides/ecosystem/drizzle.mdx +195 -0
- package/docs/guides/ecosystem/edgedb.mdx +257 -0
- package/docs/guides/ecosystem/elysia.mdx +31 -0
- package/docs/guides/ecosystem/express.mdx +43 -0
- package/docs/guides/ecosystem/hono.mdx +47 -0
- package/docs/guides/ecosystem/mongoose.mdx +92 -0
- package/docs/guides/ecosystem/neon-drizzle.mdx +234 -0
- package/docs/guides/ecosystem/neon-serverless-postgres.mdx +60 -0
- package/docs/guides/ecosystem/nextjs.mdx +57 -0
- package/docs/guides/ecosystem/nuxt.mdx +90 -0
- package/docs/guides/ecosystem/pm2.mdx +55 -0
- package/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
- package/docs/guides/ecosystem/prisma.mdx +164 -0
- package/docs/guides/ecosystem/qwik.mdx +114 -0
- package/docs/guides/ecosystem/react.mdx +52 -0
- package/docs/guides/ecosystem/remix.mdx +97 -0
- package/docs/guides/ecosystem/sentry.mdx +54 -0
- package/docs/guides/ecosystem/solidstart.mdx +66 -0
- package/docs/guides/ecosystem/ssr-react.mdx +49 -0
- package/docs/guides/ecosystem/stric.mdx +54 -0
- package/docs/guides/ecosystem/sveltekit.mdx +138 -0
- package/docs/guides/ecosystem/systemd.mdx +114 -0
- package/docs/guides/ecosystem/upstash.mdx +87 -0
- package/docs/guides/ecosystem/vite.mdx +77 -0
- package/docs/guides/html-rewriter/extract-links.mdx +72 -0
- package/docs/guides/html-rewriter/extract-social-meta.mdx +97 -0
- package/docs/guides/http/cluster.mdx +69 -0
- package/docs/guides/http/fetch-unix.mdx +35 -0
- package/docs/guides/http/fetch.mdx +26 -0
- package/docs/guides/http/file-uploads.mdx +97 -0
- package/docs/guides/http/hot.mdx +28 -0
- package/docs/guides/http/proxy.mdx +26 -0
- package/docs/guides/http/server.mdx +48 -0
- package/docs/guides/http/simple.mdx +20 -0
- package/docs/guides/http/stream-file.mdx +50 -0
- package/docs/guides/http/stream-iterator.mdx +49 -0
- package/docs/guides/http/stream-node-streams-in-bun.mdx +22 -0
- package/docs/guides/http/tls.mdx +32 -0
- package/docs/guides/index.mdx +10 -0
- package/docs/guides/install/add-dev.mdx +28 -0
- package/docs/guides/install/add-git.mdx +38 -0
- package/docs/guides/install/add-optional.mdx +27 -0
- package/docs/guides/install/add-peer.mdx +45 -0
- package/docs/guides/install/add-tarball.mdx +35 -0
- package/docs/guides/install/add.mdx +44 -0
- package/docs/guides/install/azure-artifacts.mdx +76 -0
- package/docs/guides/install/cicd.mdx +43 -0
- package/docs/guides/install/custom-registry.mdx +32 -0
- package/docs/guides/install/from-npm-install-to-bun-install.mdx +230 -0
- package/docs/guides/install/git-diff-bun-lockfile.mdx +47 -0
- package/docs/guides/install/jfrog-artifactory.mdx +28 -0
- package/docs/guides/install/npm-alias.mdx +25 -0
- package/docs/guides/install/registry-scope.mdx +40 -0
- package/docs/guides/install/trusted.mdx +50 -0
- package/docs/guides/install/workspaces.mdx +70 -0
- package/docs/guides/install/yarnlock.mdx +50 -0
- package/docs/guides/process/argv.mdx +66 -0
- package/docs/guides/process/ctrl-c.mdx +18 -0
- package/docs/guides/process/ipc.mdx +69 -0
- package/docs/guides/process/nanoseconds.mdx +15 -0
- package/docs/guides/process/os-signals.mdx +41 -0
- package/docs/guides/process/spawn-stderr.mdx +34 -0
- package/docs/guides/process/spawn-stdout.mdx +28 -0
- package/docs/guides/process/spawn.mdx +43 -0
- package/docs/guides/process/stdin.mdx +62 -0
- package/docs/guides/read-file/arraybuffer.mdx +30 -0
- package/docs/guides/read-file/buffer.mdx +21 -0
- package/docs/guides/read-file/exists.mdx +18 -0
- package/docs/guides/read-file/json.mdx +19 -0
- package/docs/guides/read-file/mime.mdx +22 -0
- package/docs/guides/read-file/stream.mdx +28 -0
- package/docs/guides/read-file/string.mdx +24 -0
- package/docs/guides/read-file/uint8array.mdx +23 -0
- package/docs/guides/read-file/watch.mdx +66 -0
- package/docs/guides/runtime/build-time-constants.mdx +295 -0
- package/docs/guides/runtime/cicd.mdx +45 -0
- package/docs/guides/runtime/codesign-macos-executable.mdx +61 -0
- package/docs/guides/runtime/define-constant.mdx +149 -0
- package/docs/guides/runtime/delete-directory.mdx +39 -0
- package/docs/guides/runtime/delete-file.mdx +21 -0
- package/docs/guides/runtime/heap-snapshot.mdx +28 -0
- package/docs/guides/runtime/import-html.mdx +17 -0
- package/docs/guides/runtime/import-json.mdx +46 -0
- package/docs/guides/runtime/import-toml.mdx +32 -0
- package/docs/guides/runtime/import-yaml.mdx +104 -0
- package/docs/guides/runtime/read-env.mdx +37 -0
- package/docs/guides/runtime/set-env.mdx +51 -0
- package/docs/guides/runtime/shell.mdx +42 -0
- package/docs/guides/runtime/timezone.mdx +38 -0
- package/docs/guides/runtime/tsconfig-paths.mdx +31 -0
- package/docs/guides/runtime/typescript.mdx +51 -0
- package/docs/guides/runtime/vscode-debugger.mdx +48 -0
- package/docs/guides/runtime/web-debugger.mdx +103 -0
- package/docs/guides/streams/node-readable-to-arraybuffer.mdx +13 -0
- package/docs/guides/streams/node-readable-to-blob.mdx +13 -0
- package/docs/guides/streams/node-readable-to-json.mdx +14 -0
- package/docs/guides/streams/node-readable-to-string.mdx +14 -0
- package/docs/guides/streams/node-readable-to-uint8array.mdx +13 -0
- package/docs/guides/streams/to-array.mdx +16 -0
- package/docs/guides/streams/to-arraybuffer.mdx +16 -0
- package/docs/guides/streams/to-blob.mdx +16 -0
- package/docs/guides/streams/to-buffer.mdx +17 -0
- package/docs/guides/streams/to-json.mdx +16 -0
- package/docs/guides/streams/to-string.mdx +16 -0
- package/docs/guides/streams/to-typedarray.mdx +24 -0
- package/docs/guides/test/bail.mdx +24 -0
- package/docs/guides/test/coverage-threshold.mdx +67 -0
- package/docs/guides/test/coverage.mdx +49 -0
- package/docs/guides/test/happy-dom.mdx +73 -0
- package/docs/guides/test/migrate-from-jest.mdx +125 -0
- package/docs/guides/test/mock-clock.mdx +50 -0
- package/docs/guides/test/mock-functions.mdx +70 -0
- package/docs/guides/test/rerun-each.mdx +16 -0
- package/docs/guides/test/run-tests.mdx +116 -0
- package/docs/guides/test/skip-tests.mdx +43 -0
- package/docs/guides/test/snapshot.mdx +102 -0
- package/docs/guides/test/spy-on.mdx +49 -0
- package/docs/guides/test/svelte-test.mdx +113 -0
- package/docs/guides/test/testing-library.mdx +93 -0
- package/docs/guides/test/timeout.mdx +17 -0
- package/docs/guides/test/todo-tests.mdx +74 -0
- package/docs/guides/test/update-snapshots.mdx +49 -0
- package/docs/guides/test/watch-mode.mdx +24 -0
- package/docs/guides/util/base64.mdx +17 -0
- package/docs/guides/util/deep-equals.mdx +41 -0
- package/docs/guides/util/deflate.mdx +20 -0
- package/docs/guides/util/detect-bun.mdx +25 -0
- package/docs/guides/util/entrypoint.mdx +19 -0
- package/docs/guides/util/escape-html.mdx +24 -0
- package/docs/guides/util/file-url-to-path.mdx +16 -0
- package/docs/guides/util/gzip.mdx +20 -0
- package/docs/guides/util/hash-a-password.mdx +56 -0
- package/docs/guides/util/import-meta-dir.mdx +15 -0
- package/docs/guides/util/import-meta-file.mdx +15 -0
- package/docs/guides/util/import-meta-path.mdx +15 -0
- package/docs/guides/util/javascript-uuid.mdx +25 -0
- package/docs/guides/util/main.mdx +43 -0
- package/docs/guides/util/path-to-file-url.mdx +16 -0
- package/docs/guides/util/sleep.mdx +24 -0
- package/docs/guides/util/version.mdx +23 -0
- package/docs/guides/util/which-path-to-executable-bin.mdx +17 -0
- package/docs/guides/websocket/compression.mdx +33 -0
- package/docs/guides/websocket/context.mdx +74 -0
- package/docs/guides/websocket/pubsub.mdx +40 -0
- package/docs/guides/websocket/simple.mdx +35 -0
- package/docs/guides/write-file/append.mdx +54 -0
- package/docs/guides/write-file/basic.mdx +46 -0
- package/docs/guides/write-file/blob.mdx +30 -0
- package/docs/guides/write-file/cat.mdx +19 -0
- package/docs/guides/write-file/file-cp.mdx +18 -0
- package/docs/guides/write-file/filesink.mdx +54 -0
- package/docs/guides/write-file/response.mdx +19 -0
- package/docs/guides/write-file/stdout.mdx +23 -0
- package/docs/guides/write-file/stream.mdx +19 -0
- package/docs/guides/write-file/unlink.mdx +18 -0
- package/docs/index.mdx +133 -0
- package/docs/installation.mdx +365 -0
- package/docs/pm/bunx.mdx +83 -0
- package/docs/pm/catalogs.mdx +292 -0
- package/docs/pm/cli/add.mdx +179 -0
- package/docs/pm/cli/audit.mdx +60 -0
- package/docs/pm/cli/install.mdx +471 -0
- package/docs/pm/cli/link.mdx +48 -0
- package/docs/pm/cli/outdated.mdx +197 -0
- package/docs/pm/cli/patch.mdx +69 -0
- package/docs/pm/cli/pm.mdx +319 -0
- package/docs/pm/cli/publish.mdx +123 -0
- package/docs/pm/cli/remove.mdx +16 -0
- package/docs/pm/cli/update.mdx +140 -0
- package/docs/pm/cli/why.mdx +84 -0
- package/docs/pm/filter.mdx +102 -0
- package/docs/pm/global-cache.mdx +72 -0
- package/docs/pm/isolated-installs.mdx +205 -0
- package/docs/pm/lifecycle.mdx +57 -0
- package/docs/pm/lockfile.mdx +64 -0
- package/docs/pm/npmrc.mdx +111 -0
- package/docs/pm/overrides.mdx +83 -0
- package/docs/pm/scopes-registries.mdx +35 -0
- package/docs/pm/security-scanner-api.mdx +95 -0
- package/docs/pm/workspaces.mdx +109 -0
- package/docs/project/benchmarking.mdx +218 -0
- package/docs/project/bindgen.mdx +223 -0
- package/docs/project/building-windows.mdx +133 -0
- package/docs/project/contributing.mdx +343 -0
- package/docs/project/feedback.mdx +20 -0
- package/docs/project/license.mdx +78 -0
- package/docs/project/roadmap.mdx +8 -0
- package/docs/quickstart.mdx +240 -0
- package/docs/runtime/auto-install.mdx +97 -0
- package/docs/runtime/binary-data.mdx +846 -0
- package/docs/runtime/bun-apis.mdx +59 -0
- package/docs/runtime/bunfig.mdx +642 -0
- package/docs/runtime/c-compiler.mdx +204 -0
- package/docs/runtime/child-process.mdx +532 -0
- package/docs/runtime/color.mdx +267 -0
- package/docs/runtime/console.mdx +67 -0
- package/docs/runtime/cookies.mdx +454 -0
- package/docs/runtime/debugger.mdx +335 -0
- package/docs/runtime/environment-variables.mdx +214 -0
- package/docs/runtime/ffi.mdx +565 -0
- package/docs/runtime/file-io.mdx +306 -0
- package/docs/runtime/file-system-router.mdx +118 -0
- package/docs/runtime/file-types.mdx +354 -0
- package/docs/runtime/glob.mdx +181 -0
- package/docs/runtime/globals.mdx +72 -0
- package/docs/runtime/hashing.mdx +315 -0
- package/docs/runtime/html-rewriter.mdx +340 -0
- package/docs/runtime/http/cookies.mdx +79 -0
- package/docs/runtime/http/error-handling.mdx +40 -0
- package/docs/runtime/http/metrics.mdx +36 -0
- package/docs/runtime/http/routing.mdx +289 -0
- package/docs/runtime/http/server.mdx +647 -0
- package/docs/runtime/http/tls.mdx +101 -0
- package/docs/runtime/http/websockets.mdx +404 -0
- package/docs/runtime/index.mdx +223 -0
- package/docs/runtime/jsx.mdx +115 -0
- package/docs/runtime/module-resolution.mdx +342 -0
- package/docs/runtime/networking/dns.mdx +111 -0
- package/docs/runtime/networking/fetch.mdx +468 -0
- package/docs/runtime/networking/tcp.mdx +239 -0
- package/docs/runtime/networking/udp.mdx +129 -0
- package/docs/runtime/node-api.mdx +19 -0
- package/docs/runtime/nodejs-compat.mdx +468 -0
- package/docs/runtime/plugins.mdx +405 -0
- package/docs/runtime/redis.mdx +582 -0
- package/docs/runtime/s3.mdx +863 -0
- package/docs/runtime/secrets.mdx +336 -0
- package/docs/runtime/semver.mdx +57 -0
- package/docs/runtime/shell.mdx +637 -0
- package/docs/runtime/sql.mdx +1404 -0
- package/docs/runtime/sqlite.mdx +699 -0
- package/docs/runtime/streams.mdx +232 -0
- package/docs/runtime/templating/create.mdx +269 -0
- package/docs/runtime/templating/init.mdx +58 -0
- package/docs/runtime/transpiler.mdx +288 -0
- package/docs/runtime/typescript.mdx +58 -0
- package/docs/runtime/utils.mdx +922 -0
- package/docs/runtime/watch-mode.mdx +161 -0
- package/docs/runtime/web-apis.mdx +29 -0
- package/docs/runtime/workers.mdx +328 -0
- package/docs/runtime/yaml.mdx +469 -0
- package/docs/snippets/cli/add.mdx +166 -0
- package/docs/snippets/cli/build.mdx +196 -0
- package/docs/snippets/cli/feedback.mdx +17 -0
- package/docs/snippets/cli/init.mdx +84 -0
- package/docs/snippets/cli/install.mdx +173 -0
- package/docs/snippets/cli/link.mdx +163 -0
- package/docs/snippets/cli/outdated.mdx +140 -0
- package/docs/snippets/cli/patch.mdx +171 -0
- package/docs/snippets/cli/publish.mdx +198 -0
- package/docs/snippets/cli/remove.mdx +146 -0
- package/docs/snippets/cli/run.mdx +293 -0
- package/docs/snippets/cli/test.mdx +100 -0
- package/docs/snippets/cli/update.mdx +144 -0
- package/docs/snippets/product-card.mdx +32 -0
- package/docs/snippets/product-tiles.mdx +94 -0
- package/docs/test/code-coverage.mdx +409 -0
- package/docs/test/configuration.mdx +467 -0
- package/docs/test/dates-times.mdx +129 -0
- package/docs/test/discovery.mdx +90 -0
- package/docs/test/dom.mdx +226 -0
- package/docs/test/index.mdx +380 -0
- package/docs/test/lifecycle.mdx +348 -0
- package/docs/test/mocks.mdx +637 -0
- package/docs/test/reporters.mdx +117 -0
- package/docs/test/runtime-behavior.mdx +342 -0
- package/docs/test/snapshots.mdx +434 -0
- package/docs/test/writing-tests.mdx +635 -0
- package/docs/typescript.mdx +54 -0
- package/package.json +8 -6
- package/test.d.ts +2 -2
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Installation
|
|
3
|
+
description: Install Bun
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Bun ships as a single, dependency-free executable. You can install it via script, package manager, or Docker across macOS, Linux, and Windows.
|
|
9
|
+
|
|
10
|
+
<Tip>After installation, verify with `bun --version` and `bun --revision`.</Tip>
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
<Tabs>
|
|
15
|
+
<Tab title="macOS & Linux">
|
|
16
|
+
|
|
17
|
+
<CodeGroup>
|
|
18
|
+
```bash curl icon="globe"
|
|
19
|
+
curl -fsSL https://bun.com/install | bash
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
</CodeGroup>
|
|
23
|
+
<Note>
|
|
24
|
+
**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 strongly recommended, but the minimum is 5.1. Use `uname -r` to check Kernel version.
|
|
25
|
+
</Note>
|
|
26
|
+
|
|
27
|
+
</Tab>
|
|
28
|
+
|
|
29
|
+
<Tab title="Windows">
|
|
30
|
+
<CodeGroup>
|
|
31
|
+
```powershell PowerShell icon="terminal"
|
|
32
|
+
powershell -c "irm bun.sh/install.ps1|iex"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
</CodeGroup>
|
|
36
|
+
<Warning>
|
|
37
|
+
Bun requires Windows 10 version 1809 or later.
|
|
38
|
+
</Warning>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
For support and discussion, please join the **#windows** channel on our [Discord](https://discord.gg/bun).
|
|
42
|
+
|
|
43
|
+
</Tab>
|
|
44
|
+
|
|
45
|
+
<Tab title="Package Managers">
|
|
46
|
+
<CodeGroup>
|
|
47
|
+
|
|
48
|
+
```bash npm icon="npm"
|
|
49
|
+
npm install -g bun # the last `npm` command you'll ever need
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```bash Homebrew icon="/icons/homebrew.svg"
|
|
53
|
+
brew install oven-sh/bun/bun
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```bash Scoop icon="terminal"
|
|
57
|
+
scoop install bun
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
</CodeGroup>
|
|
61
|
+
|
|
62
|
+
</Tab>
|
|
63
|
+
|
|
64
|
+
<Tab title="Docker">
|
|
65
|
+
Bun provides a Docker image that supports both Linux x64 and arm64.
|
|
66
|
+
|
|
67
|
+
```bash Docker icon="docker"
|
|
68
|
+
docker pull oven/bun
|
|
69
|
+
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Image Variants
|
|
73
|
+
|
|
74
|
+
There are also image variants for different operating systems:
|
|
75
|
+
|
|
76
|
+
```bash Docker icon="docker"
|
|
77
|
+
docker pull oven/bun:debian
|
|
78
|
+
docker pull oven/bun:slim
|
|
79
|
+
docker pull oven/bun:distroless
|
|
80
|
+
docker pull oven/bun:alpine
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
</Tab>
|
|
84
|
+
</Tabs>
|
|
85
|
+
|
|
86
|
+
To check that Bun was installed successfully, open a new terminal window and run:
|
|
87
|
+
|
|
88
|
+
```bash terminal icon="terminal"
|
|
89
|
+
bun --version
|
|
90
|
+
# Output: 1.x.y
|
|
91
|
+
|
|
92
|
+
# See the precise commit of `oven-sh/bun` that you're using
|
|
93
|
+
bun --revision
|
|
94
|
+
# Output: 1.x.y+b7982ac13189
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
<Warning>
|
|
98
|
+
If you've installed Bun but are seeing a `command not found` error, you may have to manually add the installation
|
|
99
|
+
directory (`~/.bun/bin`) to your `PATH`.
|
|
100
|
+
</Warning>
|
|
101
|
+
|
|
102
|
+
<Accordion title="Add Bun to your PATH">
|
|
103
|
+
<Tabs>
|
|
104
|
+
<Tab title="macOS & Linux">
|
|
105
|
+
<Steps>
|
|
106
|
+
<Step title="Determine which shell you're using">
|
|
107
|
+
```bash terminal icon="terminal"
|
|
108
|
+
echo $SHELL
|
|
109
|
+
# /bin/zsh or /bin/bash or /bin/fish
|
|
110
|
+
```
|
|
111
|
+
</Step>
|
|
112
|
+
<Step title="Open your shell configuration file">
|
|
113
|
+
- For bash: `~/.bashrc`
|
|
114
|
+
- For zsh: `~/.zshrc`
|
|
115
|
+
- For fish: `~/.config/fish/config.fish`
|
|
116
|
+
</Step>
|
|
117
|
+
|
|
118
|
+
<Step title="Add the Bun directory to PATH">
|
|
119
|
+
Add this line to your configuration file:
|
|
120
|
+
```bash terminal icon="terminal"
|
|
121
|
+
export BUN_INSTALL="$HOME/.bun"
|
|
122
|
+
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
123
|
+
```
|
|
124
|
+
</Step>
|
|
125
|
+
|
|
126
|
+
<Step title="Reload your shell configuration">
|
|
127
|
+
```bash terminal icon="terminal"
|
|
128
|
+
source ~/.bashrc # or ~/.zshrc
|
|
129
|
+
```
|
|
130
|
+
</Step>
|
|
131
|
+
</Steps>
|
|
132
|
+
</Tab>
|
|
133
|
+
<Tab title="Windows">
|
|
134
|
+
<Steps>
|
|
135
|
+
<Step title="Determine if the bun binary is properly installed">
|
|
136
|
+
```bash terminal icon="terminal"
|
|
137
|
+
& "$env:USERPROFILE\.bun\bin\bun" --version
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
If 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:
|
|
141
|
+
|
|
142
|
+
```bash terminal icon="terminal"
|
|
143
|
+
[System.Environment]::SetEnvironmentVariable(
|
|
144
|
+
"Path",
|
|
145
|
+
[System.Environment]::GetEnvironmentVariable("Path", "User") + ";$env:USERPROFILE\.bun\bin",
|
|
146
|
+
[System.EnvironmentVariableTarget]::User
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
</Step>
|
|
151
|
+
<Step title="Restart your terminal">
|
|
152
|
+
After running the command, restart your terminal and test with `bun --version`
|
|
153
|
+
|
|
154
|
+
```bash terminal icon="terminal"
|
|
155
|
+
bun --version
|
|
156
|
+
```
|
|
157
|
+
</Step>
|
|
158
|
+
</Steps>
|
|
159
|
+
</Tab>
|
|
160
|
+
|
|
161
|
+
</Tabs>
|
|
162
|
+
</Accordion>
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Upgrading
|
|
167
|
+
|
|
168
|
+
Once installed, the binary can upgrade itself:
|
|
169
|
+
|
|
170
|
+
```bash terminal icon="terminal"
|
|
171
|
+
bun upgrade
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
<Tip>
|
|
175
|
+
**Homebrew users** <br />
|
|
176
|
+
To avoid conflicts with Homebrew, use `brew upgrade bun` instead.
|
|
177
|
+
|
|
178
|
+
**Scoop users** <br />
|
|
179
|
+
To avoid conflicts with Scoop, use `scoop update bun` instead.
|
|
180
|
+
|
|
181
|
+
</Tip>
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Canary Builds
|
|
186
|
+
|
|
187
|
+
[-> View canary build](https://github.com/oven-sh/bun/releases/tag/canary)
|
|
188
|
+
|
|
189
|
+
Bun automatically releases an (untested) canary build on every commit to main. To upgrade to the latest canary build:
|
|
190
|
+
|
|
191
|
+
```bash terminal icon="terminal"
|
|
192
|
+
# Upgrade to latest canary
|
|
193
|
+
bun upgrade --canary
|
|
194
|
+
|
|
195
|
+
# Switch back to stable
|
|
196
|
+
bun upgrade --stable
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The 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.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Installing Older Versions
|
|
204
|
+
|
|
205
|
+
Since Bun is a single binary, you can install older versions by re-running the installer script with a specific version.
|
|
206
|
+
|
|
207
|
+
<Tabs>
|
|
208
|
+
<Tab title="Linux & macOS">
|
|
209
|
+
To install a specific version, pass the git tag to the install script:
|
|
210
|
+
|
|
211
|
+
```bash terminal icon="terminal"
|
|
212
|
+
curl -fsSL https://bun.com/install | bash -s "bun-v1.3.1"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
</Tab>
|
|
216
|
+
<Tab title="Windows">
|
|
217
|
+
On Windows, pass the version number to the PowerShell install script:
|
|
218
|
+
|
|
219
|
+
```powershell PowerShell icon="windows"
|
|
220
|
+
iex "& {$(irm https://bun.com/install.ps1)} -Version 1.3.1"
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
</Tab>
|
|
224
|
+
</Tabs>
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Direct Downloads
|
|
229
|
+
|
|
230
|
+
To download Bun binaries directly, visit the [releases page on GitHub](https://github.com/oven-sh/bun/releases).
|
|
231
|
+
|
|
232
|
+
### Latest Version Downloads
|
|
233
|
+
|
|
234
|
+
<CardGroup cols={2}>
|
|
235
|
+
<Card
|
|
236
|
+
icon="/icons/linux.svg"
|
|
237
|
+
title="Linux x64"
|
|
238
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"
|
|
239
|
+
>
|
|
240
|
+
Standard Linux x64 binary
|
|
241
|
+
</Card>
|
|
242
|
+
<Card
|
|
243
|
+
icon="/icons/linux.svg"
|
|
244
|
+
title="Linux x64 Baseline"
|
|
245
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-baseline.zip"
|
|
246
|
+
>
|
|
247
|
+
For older CPUs without AVX2
|
|
248
|
+
</Card>
|
|
249
|
+
<Card
|
|
250
|
+
icon="/icons/windows.svg"
|
|
251
|
+
title="Windows x64"
|
|
252
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-windows-x64.zip"
|
|
253
|
+
>
|
|
254
|
+
Standard Windows binary
|
|
255
|
+
</Card>
|
|
256
|
+
<Card
|
|
257
|
+
icon="/icons/windows.svg"
|
|
258
|
+
title="Windows x64 Baseline"
|
|
259
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-windows-x64-baseline.zip"
|
|
260
|
+
>
|
|
261
|
+
For older CPUs without AVX2
|
|
262
|
+
</Card>
|
|
263
|
+
<Card
|
|
264
|
+
icon="/icons/apple.svg"
|
|
265
|
+
title="macOS ARM64"
|
|
266
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-darwin-aarch64.zip"
|
|
267
|
+
>
|
|
268
|
+
Apple Silicon (M1/M2/M3)
|
|
269
|
+
</Card>
|
|
270
|
+
<Card
|
|
271
|
+
icon="/icons/apple.svg"
|
|
272
|
+
title="macOS x64"
|
|
273
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-darwin-x64.zip"
|
|
274
|
+
>
|
|
275
|
+
Intel Macs
|
|
276
|
+
</Card>
|
|
277
|
+
<Card
|
|
278
|
+
icon="/icons/linux.svg"
|
|
279
|
+
title="Linux ARM64"
|
|
280
|
+
href="https://github.com/oven-sh/bun/releases/latest/download/bun-linux-aarch64.zip"
|
|
281
|
+
>
|
|
282
|
+
ARM64 Linux systems
|
|
283
|
+
</Card>
|
|
284
|
+
</CardGroup>
|
|
285
|
+
|
|
286
|
+
### Musl Binaries
|
|
287
|
+
|
|
288
|
+
For distributions without `glibc` (Alpine Linux, Void Linux):
|
|
289
|
+
|
|
290
|
+
- [Linux x64 musl](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-musl.zip)
|
|
291
|
+
- [Linux x64 musl baseline](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64-musl-baseline.zip)
|
|
292
|
+
- [Linux ARM64 musl](https://github.com/oven-sh/bun/releases/latest/download/bun-linux-aarch64-musl.zip)
|
|
293
|
+
|
|
294
|
+
<Note>
|
|
295
|
+
If you encounter an error like `bun: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.29 not found`, try using the
|
|
296
|
+
musl binary. Bun's install script automatically chooses the correct binary for your system.
|
|
297
|
+
</Note>
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## CPU Requirements
|
|
302
|
+
|
|
303
|
+
Bun has specific CPU requirements based on the binary you're using:
|
|
304
|
+
|
|
305
|
+
<Tabs>
|
|
306
|
+
<Tab title="Standard Builds">
|
|
307
|
+
**x64 binaries** target the Haswell CPU architecture (AVX and AVX2 instructions required)
|
|
308
|
+
| Platform | Intel Requirement | AMD Requirement |
|
|
309
|
+
|----------|-------------------|-----------------|
|
|
310
|
+
| x64 | Haswell (4th gen Core) or newer | Excavator or newer |
|
|
311
|
+
</Tab>
|
|
312
|
+
|
|
313
|
+
<Tab title="Baseline Builds">
|
|
314
|
+
**x64-baseline binaries** target the Nehalem architecture for older CPUs
|
|
315
|
+
| Platform | Intel Requirement | AMD Requirement |
|
|
316
|
+
|----------|-------------------|-----------------|
|
|
317
|
+
| x64-baseline | Nehalem (1st gen Core) or newer | Bulldozer or newer |
|
|
318
|
+
|
|
319
|
+
<Warning>
|
|
320
|
+
Baseline builds are slower than regular builds. Use them only if you encounter an "Illegal
|
|
321
|
+
Instruction" error.
|
|
322
|
+
</Warning>
|
|
323
|
+
</Tab>
|
|
324
|
+
|
|
325
|
+
</Tabs>
|
|
326
|
+
|
|
327
|
+
<Note>
|
|
328
|
+
Bun does not support CPUs older than the baseline target, which mandates the SSE4.2 extension. macOS requires version
|
|
329
|
+
13.0 or later.
|
|
330
|
+
</Note>
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Uninstall
|
|
335
|
+
|
|
336
|
+
To remove Bun from your system:
|
|
337
|
+
|
|
338
|
+
<Tabs>
|
|
339
|
+
<Tab title="macOS & Linux">
|
|
340
|
+
```bash terminal icon="terminal"
|
|
341
|
+
rm -rf ~/.bun
|
|
342
|
+
```
|
|
343
|
+
</Tab>
|
|
344
|
+
|
|
345
|
+
<Tab title="Windows">
|
|
346
|
+
```powershell PowerShell icon="windows"
|
|
347
|
+
powershell -c ~\.bun\uninstall.ps1
|
|
348
|
+
```
|
|
349
|
+
</Tab>
|
|
350
|
+
|
|
351
|
+
<Tab title="Package Managers">
|
|
352
|
+
<CodeGroup>
|
|
353
|
+
```bash npm icon="npm"
|
|
354
|
+
npm uninstall -g bun
|
|
355
|
+
```
|
|
356
|
+
```bash Homebrew icon="/icons/homebrew.svg"
|
|
357
|
+
brew uninstall bun
|
|
358
|
+
```
|
|
359
|
+
```bash Scoop icon="terminal"
|
|
360
|
+
scoop uninstall bun
|
|
361
|
+
```
|
|
362
|
+
</CodeGroup>
|
|
363
|
+
</Tab>
|
|
364
|
+
|
|
365
|
+
</Tabs>
|
package/docs/pm/bunx.mdx
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "bunx"
|
|
3
|
+
description: "Run packages from npm"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<Note>`bunx` is an alias for `bun x`. The `bunx` CLI will be auto-installed when you install `bun`.</Note>
|
|
7
|
+
|
|
8
|
+
Use `bunx` to auto-install and run packages from `npm`. It's Bun's equivalent of `npx` or `yarn dlx`.
|
|
9
|
+
|
|
10
|
+
```bash terminal icon="terminal"
|
|
11
|
+
bunx cowsay "Hello world!"
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
<Note>
|
|
15
|
+
⚡️ **Speed** — With Bun's fast startup times, `bunx` is [roughly 100x
|
|
16
|
+
faster](https://twitter.com/jarredsumner/status/1606163655527059458) than `npx` for locally installed packages.
|
|
17
|
+
</Note>
|
|
18
|
+
|
|
19
|
+
Packages can declare executables in the `"bin"` field of their `package.json`. These are known as _package executables_ or _package binaries_.
|
|
20
|
+
|
|
21
|
+
```json package.json icon="file-json"
|
|
22
|
+
{
|
|
23
|
+
// ... other fields
|
|
24
|
+
"name": "my-cli",
|
|
25
|
+
"bin": {
|
|
26
|
+
"my-cli": "dist/index.js"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
These executables are commonly plain JavaScript files marked with a [shebang line](<https://en.wikipedia.org/wiki/Shebang_(Unix)>) to indicate which program should be used to execute them. The following file indicates that it should be executed with `node`.
|
|
32
|
+
|
|
33
|
+
```ts dist/index.js icon="/icons/javascript.svg"
|
|
34
|
+
#!/usr/bin/env node
|
|
35
|
+
|
|
36
|
+
console.log("Hello world!");
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
These executables can be run with `bunx`,
|
|
40
|
+
|
|
41
|
+
```bash terminal icon="terminal"
|
|
42
|
+
bunx my-cli
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
As with `npx`, `bunx` will check for a locally installed package first, then fall back to auto-installing the package from `npm`. Installed packages will be stored in Bun's global cache for future use.
|
|
46
|
+
|
|
47
|
+
## Arguments and flags
|
|
48
|
+
|
|
49
|
+
To pass additional command-line flags and arguments through to the executable, place them after the executable name.
|
|
50
|
+
|
|
51
|
+
```bash terminal icon="terminal"
|
|
52
|
+
bunx my-cli --foo bar
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Shebangs
|
|
56
|
+
|
|
57
|
+
By default, Bun respects shebangs. If an executable is marked with `#!/usr/bin/env node`, Bun will spin up a `node` process to execute the file. However, in some cases it may be desirable to run executables using Bun's runtime, even if the executable indicates otherwise. To do so, include the `--bun` flag.
|
|
58
|
+
|
|
59
|
+
```bash terminal icon="terminal"
|
|
60
|
+
bunx --bun my-cli
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The `--bun` flag must occur _before_ the executable name. Flags that appear _after_ the name are passed through to the executable.
|
|
64
|
+
|
|
65
|
+
```bash terminal icon="terminal"
|
|
66
|
+
bunx --bun my-cli # good
|
|
67
|
+
bunx my-cli --bun # bad
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Package flag
|
|
71
|
+
|
|
72
|
+
**`--package <pkg>` or `-p <pkg>`** - Run binary from specific package. Useful when binary name differs from package name:
|
|
73
|
+
|
|
74
|
+
```bash terminal icon="terminal"
|
|
75
|
+
bunx -p renovate renovate-config-validator
|
|
76
|
+
bunx --package @angular/cli ng
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
To force bun to always be used with a script, use a shebang.
|
|
80
|
+
|
|
81
|
+
```ts dist/index.js icon="/icons/javascript.svg"
|
|
82
|
+
#!/usr/bin/env bun
|
|
83
|
+
```
|