Skip to main content
The zb reset command completely removes all zerobrew data directories and reinitializes a fresh installation.
This is a destructive operation that will delete all installed packages, cached data, and store entries. This action cannot be undone.

Usage

Options

flag
Skip the confirmation prompt and proceed with reset immediately. Use with caution.
flag
Short form of --yes.

Description

The reset command performs a complete cleanup and reinitialization of zerobrew:
  1. Removes all content from ZEROBREW_ROOT directory (store, cache, metadata)
  2. Removes all content from ZEROBREW_PREFIX directory (symlinks, binaries)
  3. Reinitializes the directory structure
  4. Leaves you with a clean installation ready for fresh package installs
If the directories don’t exist, the command will report “Nothing to reset” and exit successfully.

Permission Handling

The reset command intelligently handles permission issues:
  • First attempts to remove directory contents without elevated privileges
  • If permission denied and running interactively, falls back to sudo rm -rf
  • If permission denied in non-interactive mode, exits with an error
  • Does not require sudo to recreate the directory structure after cleanup

Interactive Mode (Default)

By default, the command prompts for confirmation before proceeding:
You’ll see:
Type y and press Enter to proceed, or n (or anything else) to abort.

Non-Interactive Mode

For scripts or automation, use the --yes flag to skip the confirmation:
Or the short form:
When using --yes or -y, the command proceeds immediately without any confirmation. Use this flag carefully, especially in scripts.

Examples

Reset with confirmation prompt:
Reset without confirmation (use carefully):
Reset in a shell script:

Output

During reset:
When directories don’t exist:

Use Cases

Reset zerobrew when you need to:
  • Fix a corrupted installation
  • Start completely fresh after testing
  • Clear all packages and cached data
  • Troubleshoot persistent issues
  • Free up all disk space used by zerobrew

What Gets Removed

The reset command removes:
  • All installed packages
  • Content-addressed store entries
  • Formula cache and API cache
  • Package metadata and lock files
  • Binary symlinks in prefix directory
  • Installation manifests

What Gets Preserved

The reset command does NOT modify:
  • Shell configuration files (e.g., .bashrc, .zshrc)
  • PATH modifications made during zb init
  • User files outside zerobrew directories
After running zb reset, your shell PATH will still reference the zerobrew directories. You don’t need to run zb init again - you can immediately start installing packages.

Recovery

There is no built-in recovery mechanism for reset. If you need to preserve your package list:
Or use Brewfile with bundle:
  • zb init - Initialize zerobrew (automatically run by reset)
  • zb gc - Remove unreferenced store entries without full reset
  • zb uninstall - Remove specific packages
  • zb bundle dump - Save package list to Brewfile