1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
Bun ships as a single executable that can be installed a few different ways.
## Installing
### macOS and Linux
{% callout %}
**Linux users** — The `unzip` package is required to install Bun. Use `sudo apt install unzip` to install `unzip` package.
Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Use `uname -r` to check Kernel version.
{% /callout %}
{% codetabs %}
```bash#macOS/Linux_(curl)
$ curl -fsSL https://bun.sh/install | bash # for macOS, Linux, and WSL
# to install a specific version
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.0.0"
```
```bash#NPM
$ npm install -g bun # the last `npm` command you'll ever need
```
```bash#Homebrew
$ brew tap oven-sh/bun # for macOS and Linux
$ brew install bun
```
```bash#Docker
$ docker pull oven/bun
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
```
```bash#Proto
$ proto install bun
```
{% /codetabs %}
### Windows
Bun provides a _limited, experimental_ native build for Windows. At the moment, only the Bun runtime is supported.
- `bun <file>`
- `bun run <file>`
The test runner, package manager, and bundler are still under development. The following commands have been disabled.
- `bun test`
- `bun install/add/remove`
- `bun link/unlink`
- `bun build`
## Docker
Bun provides a [Docker image](https://hub.docker.com/r/oven/bun/tags) that supports both Linux x64 and arm64.
```bash
$ docker pull oven/bun
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun
```
There are also image variants for different operating systems.
```bash
$ docker pull oven/bun:debian
$ docker pull oven/bun:slim
$ docker pull oven/bun:alpine
$ docker pull oven/bun:distroless
```
## Checking installation
To check that Bun was installed successfully, open a new terminal window and run `bun --version`.
```sh
$ bun --version
1.x.y
```
To see the precise commit of [oven-sh/bun](https://github.com/oven-sh/bun) that you're using, run `bun --revision`.
```sh
$ bun --revision
1.x.y+b7982ac1318937560f38e0f8eb18f45eaa43480f
```
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`.
{% details summary="How to add to your `PATH`" %}
First, determine what shell you're using:
```sh
$ echo $SHELL
/bin/zsh # or /bin/bash or /bin/fish
```
Then add these lines below to bottom of your shell's configuration file.
{% codetabs %}
```bash#~/.zshrc
# add to ~/.zshrc
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
```
```bash#~/.bashrc
# add to ~/.bashrc
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
```
```sh#~/.config/fish/config.fish
# add to ~/.config/fish/config.fish
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
```
{% /codetabs %}
Save the file. You'll need to open a new shell/terminal window for the changes to take effect.
{% /details %}
## Upgrading
Once installed, the binary can upgrade itself.
```sh
$ bun upgrade
```
{% callout %}
**Homebrew users** — To avoid conflicts with Homebrew, use `brew upgrade bun` instead.
**proto users** - Use `proto install bun --pin` instead.
{% /callout %}
Bun automatically releases an (untested) canary build on every commit to `main`. To upgrade to the latest canary build:
```sh
$ bun upgrade --canary
```
[View canary build](https://github.com/oven-sh/bun/releases/tag/canary)
{% callout %}
**Note** — To switch back to a stable release from canary, run `bun upgrade` again with no flags.
{% /callout %}
<!--
## Native
Works on macOS x64 & Silicon, Linux x64, Windows Subsystem for Linux.
```sh
$ curl -fsSL https://bun.sh/install | bash
```
Once installed, the binary can upgrade itself.
```sh
$ bun upgrade
```
Bun automatically releases an (untested) canary build on every commit to `main`. To upgrade to the latest canary build:
```sh
$ bun upgrade --canary
```
## Homebrew
Works on macOS and Linux
```sh
$ brew tap oven-sh/bun
$ brew install bun
```
Homebrew recommends using `brew upgrade <package>` to install newer versions.
## Docker
Works on Linux x64
```sh
# this is a comment
$ docker pull oven/bun:edge
this is some output
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun:edge
$ docker run --rm --init --ulimit memlock=-1:-1 oven/bun:edge
this is some output
``` -->
<!-- ## Completions
Shell auto-completion should be configured automatically when Bun is installed!
If not, run the following command. It uses `$SHELL` to determine which shell you're using and writes a completion file to the appropriate place on disk. It's automatically re-run on every `bun upgrade`.
```bash
$ bun completions
```
To write the completions to a custom location:
```bash
$ bun completions > path-to-file # write to file
$ bun completions /path/to/directory # write into directory
``` -->
## Uninstall
If you need to remove Bun from your system, use the following commands.
{% codetabs %}
```bash#macOS/Linux_(curl)
$ rm -rf ~/.bun # for macOS, Linux, and WSL
```
```bash#NPM
$ npm uninstall -g bun
```
```bash#Homebrew
$ brew uninstall bun
```
```bash#Proto
$ proto uninstall bun
```
{% /codetabs %}
|