> ## 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 install

Install all dependencies for a project.

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

## Behavior

`bun install` reads `package.json` and installs all dependencies into the `node_modules` directory. If a lockfile (`bun.lockb` or `bun.lock`) exists, Bun will use it to ensure reproducible installs.

### Installation strategies

Bun uses a hoisted installation strategy by default, placing packages in a flat `node_modules` structure to maximize compatibility with Node.js and other tools.

### Lockfile

Bun generates a binary lockfile (`bun.lockb`) or text lockfile (`bun.lock`) to lock down exact package versions. The lockfile is automatically updated when dependencies change.

### Performance

Bun installs packages significantly faster than other package managers by:

* Using a global cache to avoid re-downloading packages
* Installing packages in parallel with a fast native implementation
* Using hardlinks/copying instead of symlinks when possible

## Flags

### `--production`

Skip installing `devDependencies`.

```bash theme={null}
bun install --production
```

### `--frozen-lockfile`

Don't update the lockfile. Useful in CI/CD environments.

```bash theme={null}
bun install --frozen-lockfile
```

### `--no-save`

Don't save exact package versions to lockfile.

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

### `--dry-run`

Perform a dry run without actually installing anything.

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

### `--force`

Force re-download all packages, ignoring cache.

```bash theme={null}
bun install --force
```

### `--global` (`-g`)

Install a package globally.

```bash theme={null}
bun install --global cowsay
```

### `--cwd <path>`

Set the current working directory for the install.

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

### `--backend <backend>`

Specify installation backend:

* `hardlink` - Use hardlinks (fastest, default when possible)
* `clonefile` - Use copy-on-write clones (macOS/Linux with supported filesystems)
* `copyfile` - Copy files (most compatible, slowest)
* `symlink` - Use symbolic links (compatibility mode)

```bash theme={null}
bun install --backend hardlink
```

### `--cache-dir <path>`

Specify a custom cache directory.

```bash theme={null}
bun install --cache-dir ./my-cache
```

### `--no-cache`

Ignore the cache when installing packages.

```bash theme={null}
bun install --no-cache
```

### `--no-progress`

Disable progress bar.

```bash theme={null}
bun install --no-progress
```

### `--no-summary`

Don't print summary after install.

```bash theme={null}
bun install --no-summary
```

### `--no-verify`

Skip verifying package integrity.

```bash theme={null}
bun install --no-verify
```

### `--concurrent-scripts <number>`

Set the number of scripts to run concurrently (default: number of CPU cores).

```bash theme={null}
bun install --concurrent-scripts 4
```

### `--ignore-scripts`

Skip running lifecycle scripts (install, postinstall, etc).

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

### `--trust`

Run scripts from specified packages even if they're not trusted.

```bash theme={null}
bun install --trust @types/node,@types/react
```

### `--verbose`

Enable verbose logging.

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

### `--silent`

Suppress all output except errors.

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

## Workspaces

If `package.json` includes a `workspaces` field, Bun will install dependencies for all workspace packages.

```json theme={null}
{
  "workspaces": ["packages/*"]
}
```

See [workspaces configuration](/install/workspaces) for more details.

## Configuration

Behavior can be configured in `bunfig.toml`:

```toml theme={null}
[install]
frozenLockfile = true
production = false
```

See [configuration](/install/cache) for all available options.

## Examples

### Basic install

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

+ 134 packages installed [2.51s]
```

### Install with frozen lockfile

```bash theme={null}
$ bun install --frozen-lockfile
bun install v1.0.0

+ 134 packages installed [1.83s]
```

### Install without dev dependencies

```bash theme={null}
$ bun install --production
bun install v1.0.0

+ 89 packages installed [1.42s]
```
