LinuxCommandLibrary

bun-update

Update Bun JavaScript runtime

TLDR

Update all dependencies

$ bun update
copy

Update to the latest version, regardless of its compatibility
$ bun update --latest
copy

Update a specific dependency
$ bun update [package_name]
copy

Update a dependency to a specific version
$ bun update [package_name]@[version]
copy

Update packages interactively
$ bun update [[-i|--interactive]]
copy

Update dependencies recursively across all workspaces
$ bun update [[-r|--recursive]]
copy

Update dependencies interactively and recursively
$ bun update [[-i|--interactive]] [[-r|--recursive]]
copy

SYNOPSIS

bun update [package...] [--dry-run] [--global] [--production] ...

PARAMETERS

--config
    Specify custom config file path.
Overrides auto-detection.

--development, -D, --dev
    Update only devDependencies.
Skips regular dependencies.

--dry-run
    Preview updates without modifying files.
Shows diff of changes.

--global, -g
    Update globally installed packages.
Targets global prefix.

--ignore-scripts
    Skip running package lifecycle scripts.
(prepare, postinstall, etc.)

--lockfile-only
    Update lockfile only.
Does not modify package.json.

--optional
    Include optionalDependencies in update.
Otherwise skipped if fail.

--peer
    Update peerDependencies.
Typically hoisted by host.

--production, -P, --prod
    Update only dependencies.
Skips devDependencies.

package
    Specific package name(s) to update.
e.g. bun update lodash react.

DESCRIPTION

bun update (often aliased or scripted as bun-update in some environments) is a command from Bun, the fast all-in-one JavaScript/TypeScript runtime and package manager. It updates dependencies listed in package.json to their latest compatible versions within specified semver ranges.

Bun's package manager is designed to be significantly faster than npm, Yarn, or pnpm, leveraging JavaScriptCore and native speed for installs and updates. Running bun update without arguments scans package.json, fetches the newest versions from the registry (npm by default), and regenerates bun.lockb—Bun's deterministic lockfile format. It supports workspaces, global installs, and selective updates.

This command ensures reproducible builds while keeping projects current, skipping postinstall scripts unless specified. It's ideal for CI/CD pipelines due to its speed (often 10-20x faster than alternatives). Note: It respects exact versions in lockfile unless overridden, and always prefers bun.lockb for installs.

CAVEATS

Respects semver ranges strictly; incompatible updates skipped.
No built-in --force flag—manually edit package.json for major bumps.
Global updates require write perms to prefix.
Not backward-compatible with npm-shrinkwrap.json.

EXAMPLES

bun update
Update all deps.

bun update --dry-run
Preview changes.

bun update -g
Global update.

SELF-UPDATE

To update Bun itself: bun upgrade (Linux/macOS).
Generates shim if needed.

HISTORY

Part of Bun package manager, introduced in Bun 0.5.0 (May 2023). Developed by Jarred Sumner at Oven (formerly BuyVM). Bun 1.0 stable (Oct 2023) refined update logic for better semver handling and workspace support. Widely adopted for speed in 2024.

SEE ALSO

bun install(1), bun add(1), npm update(1), yarn upgrade(1), pnpm update(1)

Copied to clipboard