zb init command sets up zerobrew for first use by creating necessary directories and configuring your shell environment to use zerobrew packages.
Usage
Options
Skip automatic shell configuration. Use this if you want to manually configure your shell or manage PATH yourself.
What Gets Initialized
Directory Structure
The following directories are created:$ZEROBREW_ROOT/store- Content-addressable package storage$ZEROBREW_ROOT/db- Package installation database$ZEROBREW_ROOT/cache- Downloaded bottle cache$ZEROBREW_ROOT/locks- Concurrency control$ZEROBREW_PREFIX/bin- Symlinks to package executables$ZEROBREW_PREFIX/Cellar- Package installation directories (kegs)
Shell Configuration
Unless--no-modify-path is specified, init adds a configuration block to your shell profile:
For Bash/Zsh:
- Environment variables (ZEROBREW_DIR, ZEROBREW_ROOT, ZEROBREW_PREFIX, etc.)
- PKG_CONFIG_PATH configuration
- SSL/TLS certificate paths (CURL_CA_BUNDLE, SSL_CERT_FILE, SSL_CERT_DIR)
- PATH updates to include zerobrew binaries
- Creates
~/.config/fish/conf.d/zerobrew.fishwith equivalent configuration
Shell Profile Detection
The command automatically detects your shell and updates the appropriate config file:| Shell | Config File Priority |
|---|---|
| zsh | .zshenv → .zshrc (respects $ZDOTDIR) |
| bash | .bash_profile → .bashrc |
| fish | .config/fish/conf.d/zerobrew.fish |
| other | .profile |
Permissions
If the target directories require elevated permissions, init will:- Prompt for
sudoto create directories - Create the directory structure
- Change ownership to your user account
/opt/zerobrew.
Examples
Standard Initialization
Configure zerobrew with default settings:Manual PATH Configuration
Skip automatic shell configuration:Custom Paths
Use environment variables to customize locations:On macOS, the prefix path is limited to 13 characters due to Mach-O binary format constraints. Longer paths will cause warnings and may fail for path-sensitive packages like git and curl.
Auto-Initialization
If you run any zerobrew command without initializing first, you’ll be prompted:--auto-init flag:
Environment Variables Set
After initialization, these environment variables are configured:Location of zerobrew installation (default:
~/.zerobrew)Location of zerobrew binaries (default:
~/.zerobrew/bin)Root directory for zerobrew data (store, db, cache)
Installation prefix for packages (bin, Cellar)
Updated to include zerobrew’s pkg-config files
SSL certificate bundle (set if ca-certificates is installed)
SSL certificate file (set if ca-certificates is installed)
SSL certificate directory (set if ca-certificates is installed)
Managed Configuration Block
The shell configuration is wrapped in marker comments:zb init again will update the configuration block without duplicating it.
Troubleshooting
Changes Not Taking Effect
After initialization, reload your shell configuration:Permission Denied
If you see permission errors, the command will prompt forsudo automatically. Ensure you have sudo privileges.
macOS Prefix Length Warning
Related Commands
zb install- Install packages after initializationzb migrate- Migrate from Homebrew