---
title: pun update
description: Resolve the dependencies again, write the lock, and install it.
---

```bash
pun update
pun update laravel/framework
pun update 'symfony/*' --with-dependencies
pun update --dry-run
```

`pun update` resolves `composer.json` to the newest allowed versions, writes `composer.lock`, and runs [`pun install`](/docs/commands/install). The lock matches the one `composer update` writes.

With package names or `vendor/*` patterns, only those packages can change. Without `composer.json`, `pun update` exits 2.

## What gets resolved

Pun reads Packagist and the `repositories` in `composer.json` and Composer's global `config.json`. It supports `composer`, `package`, and `path` repositories. Any other type fails the update.

The platform is the PHP on `PATH` and its extensions. `config.platform` overrides it. Stability settings, aliases, `replace`, `provide`, and `conflict` work as in Composer.

If the requirements clash, Pun lists the conflicts, writes nothing, and exits 2.

## Options

| Option | Effect |
| --- | --- |
| `-w`, `--with-dependencies` | Also update the named packages' dependencies, except the project's own requirements |
| `-W`, `--with-all-dependencies` | Also update the named packages' dependencies, including the project's own requirements |
| `-m`, `--minimal-changes` | Keep the locked version of every package not named, where the requirements allow |
| `--prefer-lowest` | Pick the lowest allowed versions |
| `--prefer-stable` | Prefer stable versions |
| `--dry-run` | Print the changes without writing or installing |
| `--no-install` | Write the lock but leave `vendor/` as it is |

`pun update` also takes every [`pun install`](/docs/commands/install#options) option. `--ignore-platform-req` also applies while resolving.

Pun runs `pre-update-cmd` and `post-update-cmd` instead of the install scripts. [Plugins](/docs/commands/install#scripts-and-plugins) get the same events.

## Exit codes

| Code | When |
| --- | --- |
| 0 | Resolved and installed, or nothing to change |
| 2 | Unresolvable requirements, a failed repository, or a failed install |
