bun update
Update dependencies to the newest versions their ranges allow
bun upgrade.bun update (alias bun up) updates every dependency, direct and transitive, to the newest version allowed by the ranges that request it. It then rewrites package.json and bun.lock. To ignore your declared ranges, use --latest.
bun updateTo update specific packages, pass their names. Names can be glob patterns, and ! excludes:
bun update zod
bun update jquery@3 # move the package.json entry to the newest 3.x
bun update '@types/*'
bun update '@babel/*' '!@babel/core'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. Bun preserves the operator. Withinstall.exactor--exact, Bun writes an exact version instead.- Exact pins, dist-tags (
"latest","next"), and other range forms (*,1.x,>=1.0.0) are left as written; onlybun.lockmoves.--latestrewrites them. - Bun never rewrites
catalog:references; it updates the catalog entry in the rootpackage.jsoninstead. --no-saveupdatesnode_modulesonly, leavingpackage.jsonandbun.lockuntouched.
What is held back#
- Bun never widens ranges. A package that depends on
foo@^1.0.0never getsfoo@2.x. - Versions in
patchedDependenciesstay put as long as their range allows. Bun reports them 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 Bun prints a warning. A failed request for a direct dependency is an error.
--interactive#
Use the --interactive flag to choose which packages to update:
bun update --interactive
bun update -i--interactive opens a terminal interface listing every outdated direct dependency. Bun updates the packages you select as if you had run bun update <name> ...; everything else keeps its locked version.
Interactive Interface#
The interface displays packages grouped by dependency type:
? Select packages to update - Space to toggle, Enter to confirm, a to select all, n to select none, i to invert, l to toggle latest
dependencies Current Target Latest
□ react 17.0.2 18.2.0 18.3.1
□ lodash 4.17.20 4.17.21 4.17.21
devDependencies Current Target Latest
□ typescript 4.8.0 5.0.0 5.3.3
□ @types/node 16.11.7 18.0.0 20.11.5
optionalDependencies Current Target Latest
□ some-optional-package 1.0.0 1.1.0 1.2.0Sections:
- Packages are grouped under section headers:
dependencies,devDependencies,peerDependencies,optionalDependencies - Each section shows column headers aligned with the package data
Columns:
- 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
Navigation:
- ↑/↓ Arrow keys or j/k: Move cursor
- l/L: Toggle between target and latest version for current package
Exit:
- 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
Within each section, individual packages may have a suffix ( 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, it still updates the transitive dependencies of every workspace in bun.lock.
--recursive(-r) updates every workspace'spackage.json.--filter <pattern>(-F) updates only the matching workspaces, using the filter syntax. As withbun install --filter, Bun links only the selected workspaces afterwards.
Both combine with package names, --latest, --dry-run, and --interactive (which adds a "Workspace" column).
bun update --recursive
bun update --filter './packages/*'
bun update -i -r
bun update zod -r
bun update zod --filter '...^ui'--dev, --prod, --no-optional#
Restrict which package.json entries Bun updates:
--dev(-D) updatesdevDependenciesonly.--prod(-P) updatesdependenciesandoptionalDependenciesonly.--no-optionalskipsoptionalDependencies.
They combine with names, patterns, --latest, and --interactive.
These flags only select what to update — bun update --prod still installs devDependencies.
bun update --dev
bun update --prod --latest
bun update -D '@types/*'
bun update -i --prod--global#
bun update -g updates packages installed with bun add -g:
bun update -g
bun update -g typescript--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). Bun rewrites the package.json entry to a range of the same style on the new version. Transitive dependencies still respect the ranges their dependents declare. Bun does not downgrade a dependency that is already ahead of latest (e.g. a prerelease).
bun update --latest
bun update -LIn interactive mode, press l to toggle a package between its target version (respecting semver) and the latest version.
For example, with the following package.json:
{
"dependencies": {
"react": "^17.0.2"
}
}bun updatewould update to a version that matches17.x.bun update --latestwould update to a version that matches18.xor later.
CLI Usage#
bun update [<name>[@<version>] | <pattern>]...
bun upUpdate Strategy#
Always request the latest versions from the registry & reinstall all dependencies. Alias: -f
Update packages to their latest versions. Alias: -L
Dependency Scope#
Only update devDependencies. Alias: -D
Only update dependencies and optionalDependencies. Aliases: -P,
--production
Don't update optionalDependencies
Install globally. Alias: -g
Exclude dev, optional, or peer dependencies from install
Project File Management#
Write a yarn.lock file (yarn v1). Alias: -y
Don't update package.json or save a lockfile
Save to package.json (true by default)
Disallow changes to lockfile
Save a text-based lockfile
Generate a lockfile without installing dependencies
Network & Registry#
Provide a Certificate Authority signing certificate
Same as --ca, but as a file path to the certificate
Use a specific registry by default, overriding .npmrc, bunfig.toml and environment variables
Maximum number of concurrent network requests (default 48)
Caching#
Store & load cached data from a specific directory path
Ignore manifest cache entirely
Output & Logging#
Don't log anything
Excessively verbose logging
Disable the progress bar
Don't print a summary
Script Execution#
Skip lifecycle scripts for all packages, including the project's package.json and trusted dependencies
Maximum number of concurrent jobs for lifecycle scripts (default: 2x CPU cores)
Installation Controls#
Skip verifying integrity of newly downloaded packages
Add to trustedDependencies in the project's package.json and install the package(s)
Platform-specific optimizations for installing dependencies. Possible values: clonefile (default on
macOS), hardlink (default on Linux and Windows), symlink, copyfile
General & Environment#
Specify path to config file (bunfig.toml). Alias: -c
Resolve updates but don't install packages, update package.json, or save a lockfile (the project's own
lifecycle scripts still run)
Set a specific cwd
Print this help menu. Alias: -h