By default, zerobrew installs pre-built bottles (binary packages) from Homebrew’s infrastructure for maximum speed. However, you can build packages from source when needed using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lucasgelfond/zerobrew/llms.txt
Use this file to discover all available pages before exploring further.
--build-from-source flag.
When to Build from Source
Consider building from source when:- Pre-built bottles are unavailable for your platform
- You need custom compilation flags or optimizations
- You’re debugging package issues
- You want packages optimized for your specific CPU architecture
- A bottle is corrupted or outdated
Basic Usage
Use the-s or --build-from-source flag with zb install:
Installing Multiple Packages from Source
Build all specified packages from source:wget, git, and sqlite from source, along with any dependencies.
How Source Builds Work
When you use--build-from-source, zerobrew:
- Downloads the formula definition from
homebrew-core - Fetches the source tarball or repository
- Compiles the package using Homebrew’s Ruby DSL build instructions
- Installs to zerobrew’s content-addressable store
- Links binaries to your prefix (unless
--no-linkis used)
Build Requirements
Building from source requires:- Compiler toolchain: Xcode Command Line Tools (macOS) or build-essential (Linux)
- Ruby: For executing Homebrew formula build scripts
- Dependencies: Any build-time dependencies the package requires
Installing build tools on macOS
Installing build tools on Linux
Combining with Other Flags
Build from source without linking
Build and install in one command
Performance Comparison
Typical installation times:| Package | Bottle (cold) | Bottle (warm) | From Source |
|---|---|---|---|
| jq | 392ms | 130ms | ~30s |
| sqlite | 625ms | 159ms | ~45s |
| git | ~800ms | ~200ms | ~90s |
| ffmpeg | 3481ms | 688ms | ~15min |
Dependencies
When building from source, all dependencies are also built from source by default. For example:openssl, curl, pcre2, etc. from source, significantly increasing build time.
Troubleshooting Source Builds
Build fails with compiler error
Ensure you have development tools installed:Missing build dependencies
If a build fails due to missing dependencies:Build takes too long
Some packages have many dependencies. Check what will be built:Disk space issues
Source builds require temporary disk space for:- Source code
- Intermediate build artifacts
- Final compiled binaries
llvm or gcc.
When Bottles Aren’t Available
If no pre-built bottle exists for your platform, zerobrew automatically falls back to building from source:--build-from-source flag is needed in this case.
Architecture-Specific Builds
Building from source allows optimization for your CPU:- On Apple Silicon (M1/M2), native ARM64 optimizations
- On Intel, x86_64 optimizations with CPU-specific flags
- On Linux, distribution-specific optimizations
Source Code Location
During builds, zerobrew:- Downloads sources to
$ZEROBREW_ROOT/cache - Extracts and builds in temporary directories
- Installs to
$ZEROBREW_ROOT/store/<hash> - Cleans up temporary build artifacts
Related Commands
zb install <formula>- Install using bottles (default)zb info <formula>- View package information and dependencieszb gc- Clean up unused store entries and cache files