Is Bun in /bin?

A chat that ran from March to May, kept as it went: the questions as they were asked, tidied, the answers cut down, figures put in, and what turned out wrong marked where it was said.

  1. 01Is it in /bin?
  2. 02Node first?
  3. 03If I have Node already
  4. 04That command
  5. 05Global?
  6. 06PATH, or an app
  7. 07Why PATH?
  8. 08What .zshrc is
  9. 09Three bins
  10. 10The user's bin
  11. 11Why /usr
  12. 12~/.bun/bin, not ~/bin/.bun
  13. 13Why not /usr/local/bin
  14. 14Then why is Node there?
  15. 15Where PATH is
  16. 16zsh or bash
  17. 17Where the shells live
  18. 18What runs /bin
  19. 19Node inside Bun?
  20. 20Its own Node?
  21. 21VS Code from the terminal
  22. 22Homebrew
  23. 23zsh and .zshrc
  24. 24Installed by whom
  25. 25Homebrew's own place
  26. 26Claude Code
You

A reminder, please… I think we've talked about it before.

Claude

Happy to. Give me a hint of the topic, so I can find it in our past chats.

01 · You

I know it's a package manager, but is it also installed in /bin?

Claude

You mean pnpm. Its global commands go in a folder of its own, not /bin, and if that folder isn't on you get "pnpm's global bin directory is not in PATH". pnpm bin -g says where it is.

You

I meant Bun.

Claude

Then no: Bun isn't in /bin. It installs to ~/.bun/bin/bun, in your home folder, and adds that folder to PATH in ~/.zshrc. which bun says where yours is.

02 · You

So for pnpm or npm you have to install Node first?

Claude

npm comes with Node: install Node and you have it. pnpm doesn't, and it needs Node to run; you usually install it with npm. Bun needs neither.

03 · You

So if I have Node already?

Claude

Then npm is already there, pnpm is one npm install -g pnpm away, and Bun installs beside it with curl -fsSL https://bun.sh/install | bash. They coexist.

04 · You

Break down for me what that command does.

Claude

curl fetches a URL in the terminal. -fsSL are four : fail on an error, no progress bar, but still show errors, and follow redirects. https://bun.sh/install is a shell script on Bun's site. |, the pipe, hands what's on its left to what's on its right, and bash runs it. So: download Bun's install script and run it straight away. It's a common pattern; it means trusting that script with your machine.

05 · You

Does it install Bun globally?

Claude

Yes, for you: ~/.bun/bin/bun, with a line added to ~/.zshrc so you can run bun from any folder. Packages you install with Bun can be global, bun install -g, or local to a project.

06 · You

Remind me of the difference between tools added to PATH and normal applications like Google Chrome, Figma and so on.

Claude

Command-line tools have no window: you type their name, and the finds the file through PATH. Apps like Chrome and Figma live in /Applications and you click them; Finder opens them, and PATH plays no part. Some are both: VS Code can put a code command on PATH, so code . opens the folder you're in.

07 · You

Why is it called PATH? Why is it in capitals? And you mentioned there's an OS bin and a user bin!

Claude

Because it's literally a list of paths, folders separated by colons: /usr/local/bin:/usr/bin:/bin:/Users/you/.bun/bin. The capitals are a Unix habit for an , a setting programs can read, like HOME and USER. And the system's folders, /bin, /usr/bin and /usr/local/bin, need admin rights to change, while folders in your home, like ~/.bun/bin, are yours.

You

[A screenshot of Bun's installer saying it added ~/.bun/bin to $PATH in ~/.zshrc.]

Claude

That's the installer doing it for you: it wrote two lines into ~/.zshrc, one naming Bun's folder and one putting it on PATH. Run source ~/.zshrc and this terminal sees it; new ones will on their own.

08 · You

What is this ~/.zshrc?

Claude

~ is your home folder. The dot hides the file in Finder. zsh is your shell, and rc stands for run commands: it's a script zsh runs every time a new shell starts, holding PATH lines, shortcuts (alias ll="ls -la") and settings. Edit it, then source ~/.zshrc to run it again in the shell you're in.

09 · You

What's the difference between /bin, /usr/bin and /usr/local/bin?

Claude
  • /bin: the bare minimum, the commands the system needs to boot and survive: ls, cp, the shells.
  • /usr/bin: tools that come with the operating system but aren't needed to boot: curl, zip.
  • /usr/local/bin: tools added to this machine afterwards: git, node, brew.
Fig 01
Folder
/usr/local/bin
Put there by
Installers you ran
Changed by
Anyone with sudo
Used by
Every user
On PATH
Yes
For example
node, code
Pick a folder: whose files are these, who may change them, and does the shell look there?
10 · You

So how is /usr/local/bin different from the folders in the user's bin?

Claude

Who it's for. /usr/local/bin is for every account on the machine and needs admin rights to write to. ~/.bun/bin or ~/.local/bin is inside your home: only you have it, and no admin rights are needed. On a laptop with one person it hardly shows; on a shared server it matters a lot.

11 · You

So why the /usr… in /usr/bin and /usr/local/bin?

Claude

History. Disks were small in early Unix, so the system was split over two: /bin on the first, the rest on a second, mounted at /usr. Storage grew and the split stayed. /usr/local came later: things particular to this machine, on top of the standard system. That answer said /usr stood for "Unix System Resources".

You

Aah, I thought it meant user.

Claude

Everyone does, and the folder that's really yours is ~, not /usr.

12 · You

Something else that's confusing is ~/.bun/bin. I thought Bun would be under a bin folder, not the other way round, so ~/bin/.bun.

Claude

~/.bun is Bun's own folder: its versions, cache and installs all live there, and bin is the one part of it that holds the command. Delete ~/.bun and Bun is gone, with nothing mixed into a shared folder. Each tool owns its folder and keeps a bin inside.

13 · You

Why would Bun not install in /usr/local/bin?

Claude

No password needed, since it writes only in your home; one folder to delete; room to manage its own versions; and nothing touched that belongs to the machine. Once its folder is on PATH, typing bun works the same either way.

14 · You

So how come Node is here, in /usr/local/bin… Shouldn't Node be /usr/local/node/bin, then?

Claude

Good spot: two habits. Node drops its file into the shared /usr/local/bin; Bun keeps its own folder and puts that on PATH. The answer called it an old convention and a new one, like a guest who spreads their things round the house and one who keeps them in a bag.

Fig 02
Asks for a password
Yes. These folders aren't yours
Gets on PATH
Nothing to add. /usr/local/bin is on it already
To take it out
Five places, by hand, with sudo
Four installers. Ink is a real file, an outline is a link to one. Then take each one out again.
15 · You

Okay, understood! So let's tie all this back to PATH. Where is PATH? When I install a tool, whether it's node in /usr/local/bin or bun in ~/.bun/bin/bun, where does PATH come in?

Claude

PATH is a variable in your shell's memory, set as it starts. Type bun and the shell looks in each folder on the list in turn: /usr/local/bin, no; /usr/bin, no; /bin, no; ~/.bun/bin, yes, run it. None of them, and you get command not found.

Fig 03

Looking…

Type a command and watch the shell look. Ink is where it was found; dots are folders checked and passed.

So installing Bun was: the file into ~/.bun/bin, a line into ~/.zshrc; a terminal opens, zsh reads the file and loads PATH; you type bun, and the shell finds it.

16 · You

So .zshrc is a hidden configuration file for my bash.

Claude

Almost: for zsh, not Bash. They're two shells, and each reads its own file, .zshrc and .bashrc. Add a line to .bashrc while you use zsh and it's ignored. echo $SHELL says which you have; Macs have started with zsh since Catalina, in 2019.

17 · You

And are zsh and bash installed in /usr/local/bin or /usr/bin?

Claude

In /bin: /bin/zsh, /bin/bash. The answer's reason was that everything depends on the shell, so it sits with what the system needs to start.

18 · You

So what runs the tools in /bin, if not the system?

Claude

The : the heart of the system, below /bin, which owns the processor, the memory and the disks and makes running programs possible. Press the power button and the firmware starts, then a bootloader, then the kernel, then the shell, which reads ~/.zshrc and sets PATH, and then you can type.

You

🤯

Claude

And it goes further. The bootloader runs the kernel, the firmware runs the bootloader, the firmware is wired into a chip, and the chip runs on electricity. bun install sits on top of all of it.

19 · You

So, going back to Bun. Since the new convention lets Bun make its own folder, how is Node bundled with it? And if you already had Node installed, does it work with that one, instead of its own bundled Node?

Claude

Bun doesn't bundle Node at all. It's a separate , written from scratch in Zig round a different , JavaScriptCore, built to run the same code and packages. So the two sit side by side and never meet: node app.js runs on Node's engine, bun app.js on Bun's.

20 · You

Ah, okay! So if I have a project running on Bun, it's running its own Node runtime, as opposed to the one I'd installed before.

Claude

Its own runtime, yes, though not a Node: the same sheet music, a different musician. Close enough that most code runs on both, not so close that nothing breaks, which is why a project is tested before it switches.

21 · You

How do I open VS Code from the terminal?

Claude

code . opens the folder you're in, if VS Code is on PATH. If not, open VS Code, press Command-Shift-P, and run "Shell Command: Install 'code' command in PATH". It puts /usr/local/bin/code, a link into the app, on PATH.

You

[A screenshot: zsh: command not found: code.]

Claude

That's the case: code isn't on PATH yet. Run the Shell Command from inside VS Code, then try code . again.

22 · You

What is Homebrew, and where is it installed?

Claude

A package manager for macOS: brew install git downloads, installs and later updates it. On Apple's own chips it lives in /opt/homebrew; on Intel Macs it was /usr/local. It keeps each tool's real files in a cellar, a folder per tool per version, and puts a for each in its bin, which is on PATH.

23 · You

What's the difference between zsh and .zshrc, by the way?

Claude

zsh is the program, /bin/zsh, the shell itself. .zshrc is its settings, a text file in your home it reads when it starts. The engine and the seat position.

24 · You

I didn't understand this part clearly: "/usr/local/bin: tools you manually installed system-wide. This is where tools go when installed by a developer or admin rather than the OS."

Claude

A new Mac comes with tools Apple put in /usr/bin, like curl. Then you install your own, brew install node, and those go in /usr/local/bin (or Homebrew's folder): you chose them, they weren't shipped. The furniture that came with the flat, and the furniture you brought.

25 · You

Why isn't Homebrew installed in /usr/local/bin?

Claude

On Intel Macs brew itself is in /usr/local/bin. What it installs goes first into the cellar, /usr/local/Cellar/node/21.0.0/bin/node, with only a link in bin. That's how it keeps several versions and switches between them by moving the link.

Left outTwo turns about the length of the chat and the model's context window.
You

And Bun? Just refresh my memory. How does Node come bundled with it? And is it a different Node from the one in /usr/local/bin?

Left outThe answer to that was interrupted; the question had been answered above.
26 · You

And where is Claude Code installed? I use Claude in the terminal.

Claude

With its own installer, the same way as Bun: ~/.local/bin/claude is a link, the files are in ~/.local/share/claude, and your settings in ~/.claude. Installed with npm it would be in npm's global folder; with Homebrew, in Homebrew's. which claude says which you have.

Terms