Bun is a JavaScript runtime, another alternative between: Nodejs, QuickJS, Deno and among others.
Although it is still in development, Bun is very successful due to its performance, accelerated flows and execution of simpler production codes in resource-limited environments, such as serverless functions.
Bun is a complete toolkit for JavaScript and TypeScript applications.
It was written in Zig and C++, drastically reducing startup time and memory usage.
There are a few ways to install, the most common is to use cURL and add it to your Shell configuration file, just run the commands below:
curl -fsSL https://bun.sh/install | bash
echo 'alias bun="${HOME}/.bun/bin/bun"' >> ~/.bashrc
exec $SHELL
To test, just create a basic index.js
code:
console.log("Hello, Bun!")
And run:
bun index.js
Other ways to install can be with npm, Homebrew or Docker:
# With npm
npm install -g bun
# With Homebrew
brew tap oven-sh/bun
brew install bun
# With Docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun
For more Bun features use bun --help
, visit GitHub repository or web address: https://bun.sh /.