---
title: Dev Dependencies
summary: Keep test and build tools out of production with --saveDev and --production.
icon: phosphor-duotone:flask
tags: [course]
---

Some packages are only needed while you build and test your app. In this lesson you will save a package as a dev dependency and then install your project without it.

## Save a dev dependency

Add the `--saveDev` flag when you install. CommandBox records the package under `devDependencies` instead of `dependencies` in your `box.json`.

```bash
box install testbox --saveDev
```

```json title="box.json"
{
    "dependencies": {
        "cbvalidation": "^4.0.0"
    },
    "devDependencies": {
        "testbox": "^6.0.0"
    }
}
```

Versions above are examples. Yours will match what was just installed.

## Install everything, or just production

Run `install` with no package name and CommandBox installs everything listed in your `box.json`. By default that includes dev dependencies.

```bash
box install
```

On a production server or in a deploy pipeline, skip the dev tools with `--production`.

```bash
box install --production
```

!!! tip "Which one to use"
    Use plain `box install` on your own machine and in CI where you run tests. Use `box install --production` when you build the artifact you ship.

## Where packages land

Each installed package is tracked in `installPaths` in `box.json`, mapping its slug to the folder it was installed into. CommandBox manages this for you.

```json title="box.json"
{
    "installPaths": {
        "testbox": "testbox/"
    }
}
```

You can set a path before installing to control the destination, using `package set`.

```bash
box package set installPaths.testbox=lib/testbox/
box package show installPaths
```

## Recap

- `box install <package> --saveDev` records the package under `devDependencies`.
- `box install` installs everything, `box install --production` skips dev dependencies.
- `installPaths` in `box.json` maps each package slug to its install folder.
