How to Update Global Packages with Bun
Bun does not support a -g flag for updating globally-installed packages. To update them, navigate to Bun's global install directory and run bun update from there.
The Problem: No -g Flag in Bun
When using npm, updating global packages is straightforward: npm update -g. Bun does not support this flag. Running bun update -g will not update your globally-installed packages.
Bun manages global packages differently. They are installed in a dedicated directory at ~/.bun/install/global, and you update them by running bun update from within that directory.
How to Update Global Bun Packages
Navigate to Bun's global installation directory and run the update command:
cd ~/.bun/install/global && bun update
Adding a Shell Alias
To avoid typing the full path each time, add an alias to your .bashrc or .zshrc file:
alias bunupdate='(cd ~/.bun/install/global && bun update)'
After saving the file, open a new terminal instance (or reload your shell configuration with source ~/.bashrc or source ~/.zshrc). You can then update all global Bun packages with:
bunupdate
Frequently Asked Questions
Why does Bun not support bun update -g?
Bun manages global packages in a self-contained directory (~/.bun/install/global) rather than through a global flag. This design means you update them by working directly inside that directory, the same way you would update dependencies in any other project.
How do I see which global packages are installed with Bun?
Navigate to the global install directory and run bun pm ls:
cd ~/.bun/install/global && bun pm ls
Does this work on Mac as well as Linux?
Yes. Bun uses the same ~/.bun/install/global directory on both Linux and macOS, so the same command and alias work on either platform.