---
title: pun install
description: Install dependencies from composer.lock.
---

Install the packages in `composer.lock` into `vendor/`. The result matches `composer install`.

## Usage

```bash
pun install [options]
```

```bash
pun install
pun install --no-dev --classmap-authoritative
pun install --ignore-platform-req=ext-imagick
```

## Options

| Option | Description |
| --- | --- |
| `--no-dev` | Skip `require-dev` packages. |
| `-o`, `--optimize-autoloader` | Add PSR-0 and PSR-4 classes to the class map. |
| `-a`, `--classmap-authoritative` | Load classes from the class map only. |
| `--apcu-autoloader` | Cache class lookups in APCu. |
| `--apcu-autoloader-prefix=<prefix>` | The APCu prefix. |
| `--no-autoloader` | Skip the autoloader. |
| `--no-scripts` | Skip the root package's scripts. |
| `--no-plugins` | Skip Composer plugins. |
| `--ignore-platform-req=<req>` | Ignore one PHP or extension requirement. Repeatable. |
| `--ignore-platform-reqs` | Ignore all platform requirements. |
| `--link-mode=<mode>` | `hardlink` (default), `clone` or `copy`. Also `PUN_LINK_MODE`. |
| `-d`, `--working-dir=<dir>` | Run in `<dir>`. |

## What happens

- Reads `composer.json` and `composer.lock`. Without a lock, resolves one first.
- Checks the lock matches `composer.json` and this PHP.
- Downloads packages in parallel and checks each checksum.
- Keeps one copy of each package in a shared store and links it into `vendor/`.
- Writes the autoloader and `vendor/bin`.
- Runs the install scripts and the plugins in `config.allow-plugins`.
- Skips the work when nothing changed since the last install.

With `hardlink`, editing a file in `vendor/` also changes it in other projects. Use `clone` or `copy` if you edit `vendor/` by hand. Switching an install to `clone` or `copy` gives the packages still hardlinked their own files.

## Limitations

- Installs `zip` and `tar` archives and path repositories. A path repository is symlinked, or copied when its options set `symlink: false`. A package locked with only a VCS source fails.
- Plugins don't get package events, `pre-operations-exec`, `pre-pool-create` or download events.
- No custom installer paths, such as `composer/installers`, and no plugin commands.
- A class added by hand to a package in `vendor/` reaches the class map only after that package is installed again.

## Exit codes

| Code | Meaning |
| --- | --- |
| 0 | Installed. |
| 2 | No `composer.json`, a lock this PHP can't install, or a failed download or script. |
| 4 | The lock is missing a package that `composer.json` requires. |
