To upgrade your Bun CLI version, see
bun upgrade.bun update (alias bun up) updates every dependency — direct and transitive — to the newest version allowed by the ranges that request it, then rewrites package.json and bun.lock. To ignore your declared ranges, use --latest.
terminal
! excludes:
terminal
bun update <package> updates <package> everywhere it appears in bun.lock and leaves everything else alone. This works for transitive dependencies too — bun update caniuse-lite picks up a nested fix without adding it to your package.json. A name that isn’t in bun.lock is an error.
Updated packages appear in the install summary as ↑ name old → new, with (v3.0.0 available) when a newer major is out of range. Use --dry-run to preview.
How package.json is rewritten
^1.1.0→^1.2.0,~1.1.0→~1.1.5. The operator is preserved. Withinstall.exactor--exact, an exact version is written instead.- Exact pins, dist-tags (
"latest","next"), and other range forms (*,1.x,>=1.0.0) are left as written; onlybun.lockmoves.--latestrewrites them. catalog:references are never rewritten; the catalog entry in the rootpackage.jsonis updated instead.--no-saveupdatesnode_modulesonly, leavingpackage.jsonandbun.lockuntouched.
What is held back
- Ranges are never widened. A package that depends on
foo@^1.0.0never getsfoo@2.x. - Versions in
patchedDependenciesstay put as long as their range allows, and are reported askept name@version (patched, v1.2.3 available).--latestandbun audit fixdo move them; re-create the patch withbun patchafterwards. - If a registry request for a transitive package fails, that package keeps its locked version and a warning is printed. A failed request for a direct dependency is an error.
--interactive
Use the --interactive flag to choose which packages to update:
terminal
bun update <name> ...; everything else keeps its locked version.
Interactive Interface
The interface displays packages grouped by dependency type:- Packages are grouped under section headers:
dependencies,devDependencies,peerDependencies,optionalDependencies - Each section shows column headers aligned with the package data
- Package: Package name (may have a suffix such as
dev,peer, oroptional) - Current: Currently installed version
- Target: Version that would be installed (respects semver constraints)
- Latest: Latest available version
Keyboard Controls
Selection:- Space: Toggle package selection
- Enter: Confirm selections and update
- a/A: Select all packages
- n/N: Select none
- i/I: Invert selection
- ↑/↓ Arrow keys or j/k: Move cursor
- l/L: Toggle between target and latest version for current package
- Ctrl+C or Ctrl+D: Cancel without updating
Visual Indicators
- ■ Selected packages (will be updated)
- □ Unselected packages
- ❯ Current cursor position
- Colors: Red (major), yellow (minor), green (patch) version changes
- Underlined: Currently selected update target
Package Grouping
Packages are organized in sections by dependency type:- dependencies - Regular runtime dependencies
- devDependencies - Development dependencies
- peerDependencies - Peer dependencies
- optionalDependencies - Optional dependencies
dev, peer, optional).
--recursive and --filter
In a monorepo, bun update only rewrites the package.json of the workspace you run it in (from the root, transitive dependencies of every workspace are still updated in bun.lock).
--recursive(-r) updates every workspace’spackage.json.--filter <pattern>(-F) updates only the matching workspaces, using the filter syntax. Likebun install --filter, only the selected workspaces are linked afterwards.
--latest, --dry-run, and --interactive (which adds a “Workspace” column).
terminal
--dev, --prod, --no-optional
Restrict which package.json entries are updated: --dev (-D) for devDependencies only, --prod (-P) for dependencies and optionalDependencies only, --no-optional to skip optionalDependencies. They combine with names, patterns, --latest, and --interactive.
These flags only select what to update — bun update --prod still installs devDependencies.
terminal
--global
bun update -g updates packages installed with bun add -g:
terminal
--latest
By default, bun update updates each dependency to the latest version that satisfies the version range in your package.json.
To update direct dependencies to the latest version regardless of the declared range, use --latest (-L). The package.json entry is rewritten to a range of the same style on the new version. Transitive dependencies still respect the ranges their dependents declare, and a dependency already ahead of latest (e.g. a prerelease) is not downgraded.
terminal
package.json:
package.json
bun updatewould update to a version that matches17.x.bun update --latestwould update to a version that matches18.xor later.
CLI Usage
terminal
Update Strategy
boolean
Always request the latest versions from the registry & reinstall all dependencies. Alias:
-fboolean
Update packages to their latest versions. Alias:
-LDependency Scope
boolean
Only update
devDependencies. Alias: -Dboolean
Only update
dependencies and optionalDependencies. Aliases: -P,
—productionboolean
Don’t update
optionalDependenciesboolean
Install globally. Alias:
-gstring
Exclude
dev, optional, or peer dependencies from installProject File Management
boolean
Write a
yarn.lock file (yarn v1). Alias: -yboolean
Don’t update
package.json or save a lockfileboolean
default:"true"
Save to
package.json (true by default)boolean
Disallow changes to lockfile
boolean
Save a text-based lockfile
boolean
Generate a lockfile without installing dependencies
Network & Registry
string
Provide a Certificate Authority signing certificate
string
Same as
—ca, but as a file path to the certificatestring
Use a specific registry by default, overriding
.npmrc, bunfig.toml and environment variablesnumber
default:"48"
Maximum number of concurrent network requests (default 48)
Caching
string
Store & load cached data from a specific directory path
boolean
Ignore manifest cache entirely
Output & Logging
boolean
Don’t log anything
boolean
Excessively verbose logging
boolean
Disable the progress bar
boolean
Don’t print a summary
Script Execution
boolean
Skip lifecycle scripts in the project’s
package.json (dependency scripts are never run)number
Maximum number of concurrent jobs for lifecycle scripts (default: 2x CPU cores)
Installation Controls
boolean
Skip verifying integrity of newly downloaded packages
boolean
Add to
trustedDependencies in the project’s package.json and install the package(s)string
default:"clonefile"
Platform-specific optimizations for installing dependencies. Possible values:
clonefile (default),
hardlink, symlink, copyfileGeneral & Environment
string
Specify path to config file (
bunfig.toml). Alias: -cboolean
Don’t install anything
string
Set a specific cwd
boolean
Print this help menu. Alias:
-h