Upgrade & Uninstall
NAT ships two built-in commands for lifecycle management: nat upgrade checks PyPI for updates and optionally installs them, and nat uninstall cleanly removes NAT config, data, and shell completions.
nat upgrade
If nat upgrade isn't recognized, update with pip install --upgrade nat-engine first, then use nat upgrade for future updates.
nat upgrade compares the installed nat-engine version against the latest release on PyPI, then optionally upgrades via pip.
Flags
| Flag | Description |
|---|---|
--check | Check if an update is available without installing it |
--migrate | Run alembic upgrade head after upgrading (for self-hosted deployments with a database) |
--pre | Include pre-release versions when checking or upgrading |
Examples
# Check if an update is available (dry run β nothing is installed)
nat upgrade --check
# Upgrade to the latest stable release
nat upgrade
# Upgrade and apply database migrations (self-hosted deployments)
nat upgrade --migrate
# Upgrade to the latest pre-release
nat upgrade --preWhat it does
Check installed version
Reads the currently installed nat-engine version using importlib.metadata.
Query PyPI
Fetches the latest version from the PyPI JSON API at https://pypi.org/pypi/nat-engine/json.
Compare versions
Prints a summary showing the installed and latest versions:
nat-engine: 1.2.0 β 1.3.0 (upgrade available)If you used --check, the process stops here without making any changes.
Install the update
Runs pip install --upgrade nat-engine (or pip install --upgrade --pre nat-engine for pre-releases) and prints the new version on completion.
Run database migrations (optional)
If --migrate was passed, runs alembic upgrade head to apply any schema changes included in the new release.
For self-hosted deployments, always run nat upgrade --migrate when upgrading across minor versions to ensure the database schema stays in sync.
nat uninstall
nat uninstall removes NAT configuration files, scan data, and shell completion scripts. It does not automatically run pip uninstall β it prints the command for you to run manually.
Flags
| Flag | Short | Description |
|---|---|---|
--keep-config | Preserve .natrc files in the current directory and ~/.natrc | |
--yes | -y | Skip the confirmation prompt |
--purge | Also run alembic downgrade base and remove Docker volumes |
Examples
# Interactive uninstall β prompts for confirmation
nat uninstall
# Keep .natrc files but remove everything else
nat uninstall --keep-config
# Full purge including database tables and Docker volumes, no prompt
nat uninstall --purge --yesWhat it removes
| Item | Path | Notes |
|---|---|---|
| Local config file | ./.natrc | Skipped with --keep-config |
| Global config file | ~/.natrc | Skipped with --keep-config |
| Data directory | ~/.nat/ | Scan data, logs, reports |
| Bash completion | ~/.bash_completion.d/nat | If installed |
| Zsh completion | ~/.zsh/completions/_nat | If installed |
| Fish completion | ~/.config/fish/completions/nat.fish | If installed |
What it does NOT do
nat uninstall does not remove the Python package. After running it, uninstall the package yourself:
pip uninstall nat-engine--purge β full database and Docker cleanup
--purge is intended for self-hosted deployments and performs two additional steps:
- Runs
alembic downgrade baseto drop all database tables created by NAT - Removes Docker volumes tagged with the
natlabel
--purge permanently deletes all scan history from the database and any Docker volumes. This cannot be undone.
Full walkthrough
Run nat uninstall
nat uninstallConfirm when prompted
This will remove:
β’ .natrc (current directory)
β’ ~/.natrc
β’ ~/.nat/ data directory
β’ Shell completion files
Continue? [y/N]Use --yes / -y to skip this prompt in scripts.
Review the removal summary
NAT prints each item as it is removed:
β Removed .natrc
β Removed ~/.natrc
β Removed ~/.nat/
β Removed shell completions
To fully remove NAT, run:
pip uninstall nat-engineUninstall the Python package
pip uninstall nat-engineNext steps
- Setup Wizard β reinstall and reconfigure NAT from scratch
- CLI Reference β full command reference
- Self-Hosted Setup β production self-hosted deployment guide