> ## Documentation Index
> Fetch the complete documentation index at: https://mulerun.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrade

> Upgrade the MuleRun CLI to the latest published version

The CLI can upgrade itself in place by reinstalling the npm package.

```bash theme={null}
mulerun upgrade           # install latest
mulerun upgrade --check   # only print current vs latest; do not install
```

## Automatic upgrades

Routine commands check the registry on a TTL and auto-upgrade in the
background when a new `dist-tags.latest` is available. Disable it any of
these ways:

```bash theme={null}
export MULERUN_NO_AUTO_UPGRADE=1
# or
export MULERUN_DISABLE_AUTO_UPGRADE=1
```

While an upgrade is in flight, other `mulerun` invocations block at a
process-wide lock — the rule is "no two mulerun commands while one is
upgrading."

## Registry overrides

By default the CLI upgrades from the same npm registry it was installed
from. Override with:

```bash theme={null}
export MULERUN_NPM_REGISTRY="https://registry.example.com"
```

Non-default registries that are not on the built-in allow-list require an
explicit high-risk opt-in:

```bash theme={null}
export MULERUN_ALLOW_EXTERNAL_NPM_REGISTRY=1
```

## Tips

* `mulerun upgrade --check` is safe to call from cron — it does not
  install anything.
* Distributions whose upgrade policy is "forbidden" (sandbox, dev) cannot
  self-upgrade at all; the env-var knobs above have no effect on those
  builds.
