How to Install Bun on Debian: The Fast All-in-One JavaScript Runtime

Bun is a fast all-in-one JavaScript runtime and toolkit. Built on Apple’s JavaScriptCore engine and written largely in Zig, it bundles a runtime, a package manager, a bundler and a test runner into a single executable. In practice that means one tool can replace node, npm, yarn, webpack, esbuild and jest, while starting faster and installing dependencies dramatically quicker than the npm ecosystem you may be used to.

Bun iterates rapidly, and the official Debian repositories do not package it. The upstream install script drops a binary into your home directory outside of APT’s control, which makes upgrades and clean removal a manual affair.

The unofficial deb.griffo.io repository offers a tidier route. It ships an up-to-date, prebuilt Bun package that installs with apt and updates alongside everything else on your system.

What Makes Bun Special?

  • ⚡ Fast startup and execution - a JavaScriptCore-based runtime that boots noticeably quicker than Node.js
  • 📦 Built-in package manager - bun install resolves and installs dependencies far faster than npm or yarn
  • 🧪 Native test runner - a Jest-compatible bun test command with no extra dependencies to configure
  • 🔨 Integrated bundler - bun build bundles and minifies front-end and server code out of the box
  • 🟦 First-class TypeScript and JSX - runs .ts and .tsx files directly with no separate transpile step
  • 🔁 Node.js compatibility - implements a large surface of Node APIs so many projects run unchanged
  • 🌐 Web-standard APIs - fetch, WebSocket, Request and Response are built in
  • 🧰 One binary, no clutter - runtime, installer, bundler and test runner in a single executable

Why Use the deb.griffo.io Repository?

  • Easy installation and updates through the APT package manager you already know
  • Automatic dependency management handled by Debian packaging
  • Always tracks upstream releases so new Bun versions arrive promptly
  • No install scripts dropping unmanaged binaries into your home directory
  • Works across supported Debian releases including Bookworm, Trixie and Sid

Prerequisites

Before you begin, make sure you have:

  • A Debian-based system (Bookworm 12, Trixie 13, or Sid)
  • sudo privileges
  • curl installed (run sudo apt install curl if needed)

Step 1: Add the deb.griffo.io Repository

Add the repository’s signing key and source entry:

# Create the keyrings directory
sudo install -d -m 0755 /etc/apt/keyrings

# Download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg

# Add the repository (auto-detects your distro codename)
echo "deb [signed-by=/etc/apt/keyrings/deb.griffo.io.gpg] https://deb.griffo.io/apt $(lsb_release -sc 2>/dev/null) main" | sudo tee /etc/apt/sources.list.d/deb.griffo.io.list > /dev/null

# Update the package list
sudo apt update

What these commands do:

  1. Create the keyrings directory with the correct permissions for the signing key.
  2. Install the GPG key, dearmoring it into a keyring APT can verify against.
  3. Add the repository, using lsb_release -sc to fill in your Debian codename automatically.
  4. Update the package list so APT sees the newly available packages.

Step 2: Update the Package List

If you did not run the final command above, refresh the index now:

sudo apt update

Step 3: Install Bun

Install Bun with a single command:

sudo apt install bun

APT downloads the latest packaged Bun release and resolves any dependencies.

Step 4: Verify the Installation

Confirm Bun is installed and on your PATH:

bun --version

You should see a version number such as:

1.2.19

For a fuller picture, bun --help lists every subcommand available.

Getting Started with Bun

Here are the workflows you will use most.

Running Code

Bun runs JavaScript and TypeScript files directly, with no transpile step for .ts or .tsx:

# Run a JavaScript or TypeScript file
bun run index.ts

# Shorthand: bun will execute the file directly
bun index.ts

# Start a script defined in package.json
bun run dev

# Watch mode: restart on file changes
bun --watch index.ts

Managing Packages

Bun’s package manager is a drop-in replacement for npm and is considerably faster:

# Install all dependencies from package.json
bun install

# Add a dependency
bun add hono

# Add a development dependency
bun add -d typescript

# Remove a dependency
bun remove hono

# Run a package binary without installing it globally
bunx cowsay "Hello from Bun"

Creating a New Project

Scaffold a project and get running in seconds:

# Initialise a new project in the current directory
bun init

# Create an app from an official or community template
bun create hono my-api
cd my-api
bun install
bun run dev

Testing

Bun ships a built-in, Jest-compatible test runner, so there is nothing extra to install:

# Run every test in the project
bun test

# Run tests in watch mode
bun test --watch

# Run a single test file
bun test ./src/math.test.ts

A minimal test looks familiar to anyone who has used Jest:

import { expect, test } from "bun:test";

test("adds numbers", () => {
  expect(2 + 2).toBe(4);
});

Keeping Bun Updated

Because Bun is installed through APT, updates come with your regular system maintenance:

sudo apt update && sudo apt upgrade

Whenever a new Bun release is packaged, this pulls it in automatically. There is no need to run bun upgrade, which is only relevant to script-based installs.

Other Tools from deb.griffo.io

The deb.griffo.io repository packages many other developer tools for Debian:

  • deno - a secure runtime for JavaScript and TypeScript
  • eza - a modern, maintained replacement for ls
  • starship - a fast, minimal prompt for any shell
  • lazygit - a terminal UI that makes Git a pleasure to use

Troubleshooting

GPG or Key Issues

If APT reports that the repository cannot be verified, re-add the signing key:

# Re-download and install the repository GPG key
curl -fsSL https://deb.griffo.io/EA0F721D231FDD3A0A17B9AC7808B4DD62C41256.asc | sudo gpg --dearmor --yes -o /etc/apt/keyrings/deb.griffo.io.gpg

# Refresh the package list
sudo apt update

Package Not Found

If APT cannot find the bun package:

  1. Make sure you ran sudo apt update after adding the repository.
  2. Confirm your Debian release is supported (Bookworm, Trixie or Sid).
  3. Check the source entry was written correctly:
cat /etc/apt/sources.list.d/deb.griffo.io.list

A Node Project Behaves Differently Under Bun

Bun implements a large part of the Node.js API surface but not all of it. If a package relies on an unsupported native module or an obscure Node internal, it may misbehave. Test your project incrementally, and consult Bun’s Node.js compatibility page if something does not work. For most modern applications, compatibility is excellent.

Uninstalling

To remove Bun:

sudo apt remove bun

To remove the repository as well:

sudo rm /etc/apt/sources.list.d/deb.griffo.io.list
sudo rm /etc/apt/keyrings/deb.griffo.io.gpg
sudo apt update

Conclusion

Bun collapses an entire JavaScript toolchain into one fast executable. Whether you are running a TypeScript file, installing dependencies, bundling a front end or executing tests, it does the job with less configuration and noticeably more speed than the traditional Node.js stack.

Installing it through the deb.griffo.io repository keeps the whole thing under APT’s control: one apt install to set it up, and future releases arrive with your normal system updates. That is a far cleaner arrangement than an install script writing into your home directory, and it means Bun stays current with no extra effort.

Resources


Disclaimer: The deb.griffo.io repository is an unofficial community project and is not affiliated with the official Debian or Ubuntu projects, or with the upstream Bun project.