Skip to main content
The bun pm command group is a set of utilities for working with Bun’s package manager.

pack

To create a tarball of the current workspace:
terminal
bun pm pack creates a .tgz file containing all files that would be published to npm, following the same rules as npm pack.

Examples

Basic usage:
terminal
Quiet mode for scripting:
terminal
Custom destination:
terminal

Options

  • --dry-run: Perform all tasks except writing the tarball to disk. Shows what would be included.
  • --destination <dir>: The directory to save the tarball in.
  • --filename <name>: An exact file name for the tarball.
  • --ignore-scripts: Skip running pre/postpack and prepare scripts.
  • --gzip-level <0-9>: Set the gzip compression level, from 0 to 9 (default 9).
  • --quiet: Print only the tarball filename, suppressing the rest of the output. Useful in scripts.
Note: --filename and --destination cannot be used at the same time.

Output Modes

Default output:
terminal
Quiet output:
terminal

bin

To print the path to the bin directory for the local project:
terminal
To print the path to the global bin directory:
terminal

ls

To print a list of installed dependencies in the current project and their resolved versions, excluding their dependencies:
terminal
To print all installed dependencies, including nth-order dependencies:
terminal
To print only trusted dependencies (those allowed to run lifecycle scripts). When trustedDependencies is set in package.json, Bun shows the packages from that list; otherwise it shows packages from its default trusted dependencies list.
terminal

whoami

Print your npm username. Requires you to be logged in (bunx npm login) with credentials in either bunfig.toml or .npmrc:
terminal

hash

To generate and print the hash of the current lockfile:
terminal
To print the string used to hash the lockfile:
terminal
To print the hash stored in the current lockfile:
terminal

cache

To print the path to Bun’s global module cache:
terminal
To clear Bun’s global module cache:
terminal

migrate

To migrate another package manager’s lockfile without installing anything:
terminal

untrusted

To print current untrusted dependencies with scripts:
terminal

trust

To run scripts for untrusted dependencies and add to trustedDependencies:
terminal
Options for the trust command:
  • --all: Trust all untrusted dependencies.

default-trusted

To print the default trusted dependencies list:
terminal
See the current list on GitHub.

version

To display current package version and help:
terminal
To bump the version in package.json:
terminal
Supports patch, minor, major, premajor, preminor, prepatch, prerelease, from-git, or specific versions like 1.2.3. By default it creates a git commit and tag; pass --no-git-tag-version to skip them.

pkg

Manage package.json data with get, set, delete, and fix operations. All commands support dot and bracket notation:
terminal
Examples:
terminal