bash: bun: command not found after install on mac

Phong Yew Tong
2 min readSep 25, 2022

--

bun website

Subscribe to TLDRStories.com to get your daily dose of tech news, condensed into a few stories.

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! 👏👏👏👏👏

Subscribe to TLDRStories.com to get your daily dose of tech news, condensed into a few stories.

--

--

Phong Yew Tong

Entrepreneurship, React, Flutter, Firebase, Typescript, Javascript, ChatGPT https://bento.me/tldrstories