bash: bun: command not found after install on mac

bun website

Why do I use bun.sh?

"Bun is a fast all-in-one JavaScript runtime" as emphasized by the creator. I have read some good comparisons between nodejs vs deno vs bun. So I decided to give it a go on my personal project as the current project has long-running jobs (a few hours) for batching. Let's see.

How to fix the Error?

If you run the bun installation command and shit happens. You are not alone.

bash: bun: command not found

  1. Install Command for Bun
curl https://bun.sh/install | bash

2. You will need to export these 2 lines into your .bashrc for bun to work. So find them now.

bun installation

3. Go to Home/Users/${your_username} directory on Mac.

looking for .bashrc

4. Hit the following key to display hidden files on the finder and click on .bashrc file.

Shift + CMD +.

5. Add

export BUN_INSTALL=”$HOME/.bun” 
export PATH=”$BUN_INSTALL/bin:$PATH”

Or (this works for me)

export BUN_INSTALL="/Users/{your_username}/.bun" 
export PATH="$BUN_INSTALL/bin:$PATH"

6. Run this command

source ~/.bashrc

7. Run

bun --version

8. Bun is installed!

bun version

Drop me some claps and follow me if this article helps you, it motivates me to create more! Thank you, everyone! 👏👏👏👏👏

--

--

Entrepreneurship, React, Flutter, Firebase, Typescript, Javascript, NodeJS, ChatGPT, Crypto, Blockchain. Visit www.gamevsus.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Phong Yew Tong

Entrepreneurship, React, Flutter, Firebase, Typescript, Javascript, NodeJS, ChatGPT, Crypto, Blockchain. Visit www.gamevsus.com