> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/zhcndoc/bun/llms.txt
> Use this file to discover all available pages before exploring further.

# bun update

Update dependencies to their latest versions.

```bash theme={null}
bun update
```

## Behavior

`bun update` updates packages to the latest versions that satisfy the version ranges in `package.json`. The lockfile is updated to reflect the new versions.

### Update all packages

```bash theme={null}
bun update
```

Updates all dependencies in `package.json`.

### Update specific packages

```bash theme={null}
bun update <package>
```

Updates only the specified package(s).

## Arguments

### Package name

```bash theme={null}
bun update react
```

### Multiple packages

```bash theme={null}
bun update react react-dom typescript
```

### Scoped packages

```bash theme={null}
bun update @types/node
```

## Flags

### `--latest`

Update to the absolute latest version, ignoring semver ranges in `package.json`.

```bash theme={null}
bun update --latest
```

This updates all packages to their latest versions and modifies `package.json` with new version ranges.

```bash theme={null}
# Update specific packages to latest
bun update --latest react react-dom
```

### `--interactive` (`-i`)

Interactively select which packages to update.

```bash theme={null}
bun update --interactive
```

Displays an interactive prompt:

```
? Select packages to update:
  ◯ react (18.2.0 → 18.3.0)
  ◉ typescript (5.0.0 → 5.3.0)
  ◯ @types/node (20.0.0 → 20.10.0)
```

### `--no-save`

Update packages without modifying `package.json`.

```bash theme={null}
bun update --no-save
```

### `--cwd <path>`

Run command in specified directory.

```bash theme={null}
bun update --cwd ./my-project
```

### `--ignore-scripts`

Skip running lifecycle scripts during update.

```bash theme={null}
bun update --ignore-scripts
```

### `--dry-run`

Simulate update without actually installing anything.

```bash theme={null}
bun update --dry-run
```

Shows what would be updated:

```
$ bun update --dry-run

[dry-run] Would update:
  react: 18.2.0 → 18.3.0
  typescript: 5.0.0 → 5.3.0
```

### `--verbose`

Enable verbose logging.

```bash theme={null}
bun update --verbose
```

### `--silent`

Suppress all output except errors.

```bash theme={null}
bun update --silent
```

## Examples

### Update all dependencies

```bash theme={null}
$ bun update
bun update v1.0.0

 Updated react: 18.2.0 → 18.2.1
 Updated typescript: 5.0.0 → 5.0.4

 2 packages updated [534ms]
```

### Update specific package

```bash theme={null}
$ bun update react
bun update v1.0.0

 Updated react: 18.2.0 → 18.2.1

 1 package updated [287ms]
```

### Update to latest versions

```bash theme={null}
$ bun update --latest
bun update v1.0.0

 Updated react: 18.2.0 → 19.0.0
 Updated typescript: 5.0.0 → 5.3.3

 package.json updated
 2 packages updated [621ms]
```

### Interactive update

```bash theme={null}
$ bun update --interactive
bun update v1.0.0

? Select packages to update:
  ◉ react (18.2.0 → 18.3.0)
  ◉ typescript (5.0.0 → 5.3.0)
  ◯ @types/node (20.0.0 → 20.10.0)

 2 packages updated [445ms]
```

## Checking for outdated packages

To see which packages have available updates without installing them:

```bash theme={null}
bun outdated
```

See [bun outdated](/cli/outdated) for details.

## Version ranges

`bun update` respects semver ranges in `package.json`:

| Range    | Description           | Example           |
| -------- | --------------------- | ----------------- |
| `^1.2.3` | Compatible with 1.2.3 | Updates to 1.x.x  |
| `~1.2.3` | Approximately 1.2.3   | Updates to 1.2.x  |
| `1.2.3`  | Exact version         | No updates        |
| `*`      | Any version           | Updates to latest |
| `latest` | Latest tag            | Updates to latest |

Use `--latest` to ignore these ranges and update to the absolute latest version.

## Workspaces

In workspace projects, `bun update` updates dependencies across all workspaces:

```bash theme={null}
bun update
```

Update dependencies in a specific workspace:

```bash theme={null}
bun update --cwd packages/frontend react
```

## Aliases

These commands are equivalent:

```bash theme={null}
bun update
bun upgrade
```
