
# Install fob-worker

## 1. Install Node.js

fob-worker needs **Node.js 18 or later**. Install the current **LTS** release from the [official Node.js download page](https://nodejs.org/en/download). It includes npm, the package installer used below.

```bash
node --version
npm --version
```

## 2. Install fob-worker and fob-orc

```bash
npm install -g @finopsbricks/fob-worker @finopsbricks/fob-orc
fob-worker --version
fob-orc --version
```

- **fob-worker** runs your steps and reads your worker's local state. It never calls the Orchestrator.
- **fob-orc** talks to the Orchestrator: it pulls and pushes station and line definitions. You'll need it to get station files into your worker repo.

fob-worker works on the worker repo in your **current directory**, so run it from the repo's root (the folder with `package.json` and `src/steps/`).

## 3. Optional: pm2

`fob-worker procs` starts and stops your worker in the background with [pm2](https://pm2.keymetrics.io/). Install pm2 only if you'll use it:

```bash
npm install -g pm2
```

`procs` works on macOS and Linux. See [Run your worker in the background](/docs/workers/processes).

## 4. Optional: shell completion

```bash
fob-worker completion >> ~/.zshrc     # or ~/.bashrc
```

Open a new terminal. Tab completes resources, actions, and step slugs after `fob-worker steps run`.

## Optional: the fob dispatcher

If you use other FinOpsBricks CLIs, the `fob` dispatcher gives them one prefix. Any `fob-*` tool on your PATH becomes `fob <tool>`:

```bash
npm install -g @finopsbricks/fob-cli
fob worker steps list          # same as: fob-worker steps list
```

The docs use `fob-worker`. Both forms work everywhere.

## Updating

```bash
npm install -g @finopsbricks/fob-worker@latest
```

See the [changelog](/docs/workers/changelog) for what's new.

## If the command is not found

- Reopen your terminal after installing, so it picks up the new PATH.
- Check npm's global bin folder is on your PATH: `npm prefix -g` shows the install prefix, and the binaries are in its `bin` folder (on Windows, the prefix folder itself).
- An npm `EACCES` permission error means your global install folder isn't writable. Use a Node.js installed for your user account (for example with a version manager such as `nvm` or `fnm`). Don't use `sudo npm`.
