
P(rocess)
M(anager)
2
Runtime Edition
PM2 is a production process manager for Node.js/Bun applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Starting an application in production mode is as easy as:
```bash
$ pm2 start app.js
```
PM2 is constantly assailed by [a comprehensive test suite](https://github.com/Unitech/pm2/actions/workflows/node.js.yml).
Official website: [https://pm2.keymetrics.io/](https://pm2.keymetrics.io/)
Works on Linux, macOS, and Windows. Supports Node.js 18+ and Bun 1+.
## Installing PM2
### With NPM
```bash
$ npm install pm2 -g
```
### With Bun
```bash
$ bun install pm2 -g
```
If you only have Bun installed (no Node.js), symlink `node` to `bun` so PM2's `#!/usr/bin/env node` shebang resolves to Bun's node-compatibility runtime:
```bash
$ sudo ln -s $(which bun) /usr/local/bin/node
```
___
You can install Node.js easily with [NVM](https://github.com/nvm-sh/nvm#installing-and-updating) or [FNM](https://github.com/Schniz/fnm) or install Bun with `curl -fsSL https://bun.sh/install | bash`
### Start an application
You can start any application (Node.js, Bun, and also Python, Ruby, binaries in $PATH...) like that:
```bash
$ pm2 start app.js
```
Your app is now daemonized, monitored and kept alive forever.
### Managing Applications
Once applications are started you can manage them easily:

To list all running applications:
```bash
$ pm2 list
```
Managing apps is straightforward:
```bash
$ pm2 stop