---
title: Versions and Semver
summary: Control which versions you accept with semver ranges, then check and update them.
icon: phosphor-duotone:git-branch
tags: [course]
---

In this lesson you will learn the version ranges CommandBox understands, install with one, and use `outdated` and `update` to keep dependencies current.

## Semantic versions

A version has three numbers, `major.minor.patch`, such as `4.3.1`. A patch is a bug fix, a minor adds features, and a major may break things. Ranges let you say how much change you accept.

## Ranges in box.json

Ranges are written as the value of each dependency:

```json
"dependencies" : {
    "coldbox" : "^7.0.0"
}
```

| Range | Meaning |
|---|---|
| `1.2.3` | exactly that version |
| `^1.2.3` | any `1.x.x` from 1.2.3 up, never 2.0 |
| `~1.2.3` | patch updates only, so `1.2.x` |
| `>=2.0.0 <=2.5.0` | between two versions |
| `2.0.0 - 2.5.0` | the same range, as a hyphen range |
| `1.x \|\| >=2.5.0` | either condition may match |

The caret is the default range CommandBox writes when you install from ForgeBox.

## Install with a range

```bash
box install coldbox@^7.0.0
```

## Check what is behind

```bash
box outdated
```

This compares each dependency against what is available. Use `--hideUpToDate` to show only the ones with an update:

```bash
box outdated --hideUpToDate
```

## Update

```bash
box update
box update coldbox
```

With no slug, `update` upgrades every dependency that has a newer version inside its range. Pass one or more slugs, comma separated, to update only those.

!!! tip "Automating"
    Add `--force` to skip the confirmation prompt, for example `box update --force`.

## Recap

- Ranges in `box.json` set how much change you accept, `^` being the default.
- `box install name@^x.y.z` installs and saves with a range.
- `box outdated` shows what is behind and `box update` brings it forward.
