Install Bun on Ubuntu 24.04

Install Bun on Ubuntu 24.04

Bun is a modern JavaScript runtime and package manager designed to be fast and efficient. It serves as an alternative to traditional JavaScript runtime like Node.js. Bun is built from scratch to enhance performance and developer experience. This tutorial explains how to install Bun on Ubuntu 24.04.

Install Bun

Download the archive file from the releases page of the Bun repository:

wget -qO bun.zip https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip

After downloading, extract archive to temporary location:

unzip -q bun.zip

Move Bun executable to /usr/local/bin:

sudo mv bun-linux-x64/bun /usr/local/bin

Set execute permission:

sudo chmod a+x /usr/local/bin/bun

Verify Bun version using the following command:

bun --version

Delete the temporary directory and the downloaded file:

rm -rf bun-linux-x64 bun.zip

Testing Bun

Create a new main.js file:

nano main.js

Add the following a line of code:

console.log('Hello world');

Test a program with bun command:

bun main.js

Uninstall Bun

To remove Bun, simply delete its executable file:

sudo rm -rf /usr/local/bin/bun

Leave a Comment

Cancel reply

Your email address will not be published.