How to Install Bun on Ubuntu: The Fast All-in-One JavaScript Runtime
Bun is a fast all-in-one JavaScript runtime and toolkit that sets out to replace much of the Node.js ecosystem with a single binary. Written largely in Zig and powered by Apple’s JavaScriptCore engine, it combines a runtime, a package manager, a bundler and a test runner. For many teams that means bun alone can stand in for node, npm, webpack and jest, with faster startup and dramatically quicker dependency installs.
Ubuntu’s official repositories do not carry Bun, and it releases far too frequently for the archive to keep up in any case. The upstream install script works, but it places a binary in your home directory that sits outside APT, leaving upgrades and removal as manual chores.
The unofficial deb.griffo.io repository provides a cleaner alternative: a current, prebuilt Bun package you install with apt and update with the rest of your system.
What Makes Bun Special?
- ⚡ Fast startup and execution - JavaScriptCore boots quicker than Node.js for most workloads
- 📦 Built-in package manager -
bun installis dramatically faster than npm or yarn - 🧪 Native test runner - a Jest-compatible
bun testwith nothing extra to configure - 🔨 Integrated bundler -
bun buildbundles and minifies application code directly - 🟦 First-class TypeScript and JSX - runs
.tsand.tsxfiles with no separate transpile step - 🔁 Node.js compatibility - implements a large portion of Node’s APIs so many projects just work
- 🌐 Web-standard APIs -
fetch,WebSocket,RequestandResponseare built in - 🧰 One binary, no sprawl - runtime, installer, bundler and test runner all in one place
Why Use the deb.griffo.io Repository?
- Easy installation and updates through the familiar APT workflow
- Automatic dependency management courtesy of Debian-style packaging
- Always tracks upstream releases so new Bun versions land without delay
- No install scripts leaving unmanaged binaries scattered in your home directory
- Works across supported Ubuntu releases including the current LTS versions
Prerequisites
Before starting, confirm you have:
- An Ubuntu system (Jammy 22.04 LTS, Noble 24.04 LTS, or newer)
sudoprivilegescurlinstalled (install it withsudo apt install curlif necessary)
Step 1: Add the deb.griffo.io Repository
Add the GPG key and the APT source with the following commands:
# 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
In order, these commands:
- Create the keyrings directory so the signing key has a home with the correct permissions.
- Install the GPG key, dearmoring it into a keyring APT uses to verify packages.
- Add the repository, letting
lsb_release -scsubstitute your Ubuntu codename automatically. - Update the index so APT knows about the packages the repository serves.
Step 2: Update the Package List
If you skipped the last command, refresh the package index now:
sudo apt update
Step 3: Install Bun
Install the package directly:
sudo apt install bun
APT fetches the latest packaged Bun and installs any required dependencies.
Step 4: Verify the Installation
Check that Bun is present and reporting a version:
bun --version
You should see something like:
1.2.19
Run bun --help at any time to see the full list of subcommands.
Getting Started with Bun
Here are the everyday workflows to get you productive.
Creating a New Project
Getting a project off the ground takes seconds:
# Initialise a project in the current directory
bun init
# Scaffold from a template, then run it
bun create hono my-api
cd my-api
bun install
bun run dev
Managing Packages
Bun’s installer is a drop-in replacement for npm and noticeably faster:
# Install everything in package.json
bun install
# Add a runtime dependency
bun add hono
# Add a dev dependency
bun add -d typescript
# Remove a dependency
bun remove hono
# Run a package binary without a global install
bunx cowsay "Hello from Bun"
Running Code
Bun executes JavaScript and TypeScript directly, with no build step for .ts or .tsx:
# Run a TypeScript file directly
bun run index.ts
# Shorthand form
bun index.ts
# Run a package.json script
bun run dev
# Restart automatically on changes
bun --watch index.ts
Testing
The built-in test runner is Jest-compatible, so there is nothing extra to add:
# Run all tests
bun test
# Watch mode
bun test --watch
# A single file
bun test ./src/math.test.ts
A basic test reads exactly as you would expect:
import { expect, test } from "bun:test";
test("adds numbers", () => {
expect(2 + 2).toBe(4);
});
Keeping Bun Updated
Because Bun comes from an APT repository, updating it is part of your normal maintenance:
sudo apt update && sudo apt upgrade
Newly packaged Bun releases are pulled in automatically. You do not need bun upgrade, which applies only to script-based installations.
Other Tools from deb.griffo.io
The deb.griffo.io repository serves plenty of other developer tools for Ubuntu:
- 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 friendly terminal UI for Git
Troubleshooting
Package Not Found
If APT cannot find the bun package after you add the repository:
- Check that you ran
sudo apt updateonce the source was in place. - Confirm your Ubuntu release is supported (Jammy, Noble or newer).
- Verify the source entry:
cat /etc/apt/sources.list.d/deb.griffo.io.list
GPG or Key Issues
A signature or NO_PUBKEY error means the signing key needs re-adding:
# 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
A Node Project Behaves Differently Under Bun
Bun aims for broad Node.js compatibility but does not implement every API. If a dependency leans on an unsupported native module or a rarely-used Node internal, it may not behave identically. Migrate incrementally and check Bun’s Node.js compatibility page when something misbehaves. In practice, modern applications run cleanly.
Uninstalling
Remove Bun with:
sudo apt remove bun
To remove the repository too:
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 bundles an entire JavaScript toolchain into a single fast executable. Running TypeScript, installing packages, bundling assets and executing tests all happen through one tool, with less setup and more speed than the traditional Node.js pipeline.
By installing it through the deb.griffo.io repository, you keep Bun under APT’s management on Ubuntu: one command to install, and future releases arriving with your normal upgrades. It is a cleaner, more maintainable setup than an install script writing into your home directory, and it keeps Bun current without any manual 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.