DEV Community

Oleg
Oleg

Posted on

2

zsh: command not found: bun

Hello, my fellow readers!
When I first tried to set up bun I expected that Bun would work from any location on my disk. However, I encountered zsh: command not found when I tried running bun command from my repository.

The next second, I googled this error and found what seems to be the most-viewed topic on the matter here stackoverflow.
People suggest fixing this issue by adding in .bashrc file such code

export BUN_INSTALL="/home/YOUR_USERNAME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

Unfortunately, this didn't work on my Mac and I realized that .bashrc is for Linux OS and working solution in my case is:

  1. Go to /Users/{your username}
  2. Create .zshrc file if it doesn’t already exist
  3. Add the following code to the .zshrc file
export BUN_INSTALL="$HOME/.bun"
export PATH="$BUN_INSTALL/bin:$PATH"
Enter fullscreen mode Exit fullscreen mode

I hope this information is helpful to someone!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay