> ## Documentation Index
> Fetch the complete documentation index at: https://bun.manicule.dev/llms.txt
> Use this file to discover all available pages before exploring further.
> For every page in one file, fetch https://bun.manicule.dev/llms-full.txt (large).
> To search and read these docs as tools, connect the MCP server at https://bun.manicule.dev/api/mcp.
> Every agent surface: https://bun.manicule.dev/.well-known/llms-manifest.json

# Lockfile (/pm/lockfile)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 423 · updated: 2026-08-02 -->
Related: [bunx](/pm/bunx.md), [Workspaces](/pm/workspaces.md), [Catalogs](/pm/catalogs.md), [bun --filter](/pm/filter.md), [Global cache](/pm/global-cache.md), [Global virtual store](/pm/global-store.md)

> Bun's lockfile format and configuration

`bun install` creates a lockfile called `bun.lock`.

#### Should it be committed to git?

Yes

#### Generate a lockfile without installing?

To generate a lockfile without installing to `node_modules`, use the `--lockfile-only` flag. The lockfile is always saved to disk, even if it is already up to date with your project's `package.json`(s).

```bash icon="terminal" title="terminal" terminal
bun install --lockfile-only
```

<Note>`--lockfile-only` still populates the global install cache with registry metadata and git/tarball dependencies.</Note>

#### Can I opt out?

To install without creating a lockfile:

```bash icon="terminal" title="terminal" terminal
bun install --no-save
```

To write a Yarn lockfile *in addition* to `bun.lock`:

<CodeGroup>
```bash title="terminal" icon="terminal"  terminal
bun install --yarn
```

```toml title="bunfig.toml" icon="settings"
[install.lockfile]
# whether to save a non-Bun lockfile alongside bun.lock
# only "yarn" is supported
print = "yarn"
```
</CodeGroup>

#### Text-based lockfile

Bun v1.2 changed the default lockfile format to the text-based `bun.lock`. To migrate an existing binary `bun.lockb`, run `bun install --save-text-lockfile --frozen-lockfile --lockfile-only` and delete `bun.lockb`.

For more on the format, see [the blog post](https://bun.com/blog/bun-lock-text-lockfile).

#### Automatic lockfile migration

When running `bun install` in a project without a `bun.lock`, Bun automatically migrates existing lockfiles:

* `yarn.lock` (v1)
* `package-lock.json` (npm)
* `pnpm-lock.yaml` (pnpm)

The original lockfile is preserved and can be removed manually after verification.
