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

zb reset [OPTIONS]

Options

--yes
flag
Skip the confirmation prompt and proceed with reset immediately. Use with caution.
-y
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:
zb reset
You’ll see:
Warning: This will delete all zerobrew data at:
      • /Users/username/.zerobrew
      • /Users/username/.zerobrew-prefix
Continue? [y/N]
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:
zb reset --yes
Or the short form:
zb reset -y
When using --yes or -y, the command proceeds immediately without any confirmation. Use this flag carefully, especially in scripts.

Examples

Reset with confirmation prompt:
zb reset
Reset without confirmation (use carefully):
zb reset --yes
Reset in a shell script:
#!/bin/bash
echo "Cleaning up zerobrew installation..."
zb reset -y
echo "Starting fresh installation..."
zb install node python git

Output

During reset:
Warning: This will delete all zerobrew data at:
      • /Users/username/.zerobrew
      • /Users/username/.zerobrew-prefix
Continue? [y/N] y
==> Clearing /Users/username/.zerobrew...
==> Clearing /Users/username/.zerobrew-prefix...
==> Reset complete. Ready for cold install.
When directories don’t exist:
Nothing to reset - directories do not 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:
# Before reset, save your package list
zb list > my-packages.txt

# After reset, reinstall packages
zb install $(cat my-packages.txt)
Or use Brewfile with bundle:
# Before reset
zb bundle dump

# After reset
zb bundle install
  • 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

Build docs developers (and LLMs) love