Skip to main content
Install all dependencies for a project.
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.
bun install --production

--frozen-lockfile

Don’t update the lockfile. Useful in CI/CD environments.
bun install --frozen-lockfile

--no-save

Don’t save exact package versions to lockfile.
bun install --no-save

--dry-run

Perform a dry run without actually installing anything.
bun install --dry-run

--force

Force re-download all packages, ignoring cache.
bun install --force

--global (-g)

Install a package globally.
bun install --global cowsay

--cwd <path>

Set the current working directory for the install.
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)
bun install --backend hardlink

--cache-dir <path>

Specify a custom cache directory.
bun install --cache-dir ./my-cache

--no-cache

Ignore the cache when installing packages.
bun install --no-cache

--no-progress

Disable progress bar.
bun install --no-progress

--no-summary

Don’t print summary after install.
bun install --no-summary

--no-verify

Skip verifying package integrity.
bun install --no-verify

--concurrent-scripts <number>

Set the number of scripts to run concurrently (default: number of CPU cores).
bun install --concurrent-scripts 4

--ignore-scripts

Skip running lifecycle scripts (install, postinstall, etc).
bun install --ignore-scripts

--trust

Run scripts from specified packages even if they’re not trusted.
bun install --trust @types/node,@types/react

--verbose

Enable verbose logging.
bun install --verbose

--silent

Suppress all output except errors.
bun install --silent

Workspaces

If package.json includes a workspaces field, Bun will install dependencies for all workspace packages.
{
  "workspaces": ["packages/*"]
}
See workspaces configuration for more details.

Configuration

Behavior can be configured in bunfig.toml:
[install]
frozenLockfile = true
production = false
See configuration for all available options.

Examples

Basic install

$ bun install
bun install v1.0.0

+ 134 packages installed [2.51s]

Install with frozen lockfile

$ bun install --frozen-lockfile
bun install v1.0.0

+ 134 packages installed [1.83s]

Install without dev dependencies

$ bun install --production
bun install v1.0.0

+ 89 packages installed [1.42s]

Build docs developers (and LLMs) love