Exploring Package Managers: Building My Own Homebrew Tap and APT Archive
Exploring Package Managers: Building My Own Homebrew Tap and APT Archive
I’ve always been fascinated by how software gets distributed and installed on different systems. Recently, I dove deep into the world of package managers by creating my own Homebrew tap and APT archive. This journey taught me more about software distribution than any tutorial ever could.
Why Build Your Own Package Repositories?
The motivation was simple: I had built several CLI tools like dontrm and wanted an easy way to distribute them. Instead of asking users to download releases manually or compile from source, I wanted to provide that magical one-liner installation experience:
# The dream
brew install fuabioo/tap/dontrm
# or
sudo apt install dontrm
The Homebrew Tap Journey
What is a Homebrew Tap?
Think of a Homebrew tap as a third-party repository that extends Homebrew’s package catalog. While the main Homebrew repository contains thousands of formulas, taps let you distribute your own software using the same familiar interface.
My tap currently hosts 9 different tools:
dontrm
- A safer alternative to the rm commandfastfetch
- System information display toolobscura
- A private tool requiring authenticationbsontosqlite
- Convert MongoDB BSON dumps to SQLiteyq
- YAML processor (like jq for YAML)- And several others…
The Formula Structure
Homebrew formulas are Ruby files that describe how to build and install software. Here’s a simplified example:
class Dontrm < Formula
desc "Safer alternative to rm with interactive confirmations"
homepage "https://github.com/Fuabioo/dontrm"
url "https://github.com/Fuabioo/dontrm/archive/v1.0.0.tar.gz"
sha256 "abc123..."
license "MIT"
def install
system "go", "build", *std_go_args
end
test do
system "#{bin}/dontrm", "--version"
end
end
Cross-Platform Magic
One of Homebrew’s superpowers is that it works on both macOS and Linux. The same formula can build software on both platforms, providing a unified package management experience. This is especially valuable for development teams working across different operating systems.
The APT Archive Adventure
Why APT Too?
While Homebrew is excellent for development tools, many Linux servers and production environments rely on APT. Building an APT archive gave me insight into a completely different packaging paradigm.
My APT archive takes a modern approach - instead of manually creating .deb
packages, it uses a YAML specification system that automatically fetches releases from GitHub and packages them:
name: dontrm
repo: Fuabioo/dontrm
description: 'Safer alternative to rm command'
architectures:
amd64:
url: https://github.com/Fuabioo/dontrm/releases/download/v${VERSION}/dontrm_linux_amd64.tar.gz
bin_path: dontrm
arm64:
url: https://github.com/Fuabioo/dontrm/releases/download/v${VERSION}/dontrm_linux_arm64.tar.gz
bin_path: dontrm
The Technical Challenge
Building an APT archive involves several complex steps:
- Package Creation: Converting binaries into
.deb
packages - Repository Structure: Organizing packages in the correct directory layout
- Metadata Generation: Creating
Packages
files with checksums and dependencies - GPG Signing: Cryptographically signing the repository for security
- Web Hosting: Making everything accessible via HTTP
The automation scripts handle all of this, taking a simple YAML spec and producing a fully functional APT repository at https://apt.fuabioo.com
.
Lessons Learned
Package Manager Philosophy
Each package manager embodies different philosophies:
Homebrew:
- User-space installation (no sudo required)
- Latest versions from upstream
- Source-first with binary bottles for speed
- Cross-platform consistency
APT:
- System-wide installation with root privileges
- Stable, tested versions
- Binary-first for reliability
- Deep OS integration
The Distribution Spectrum
I realized there’s a whole spectrum of software distribution methods:
- Manual Downloads - Download zip files from GitHub releases
- Package Managers -
brew install
,apt install
,npm install
- Language-Specific Tools -
go install
,cargo install
,pip install
- Container Images -
docker run
,podman run
- App Stores - GUI-based installation
Each serves different use cases and user preferences.
Automation is Key
Both repositories use extensive automation:
- GitHub Actions for building and publishing
- Scripts for generating packages from specs
- Docker for reproducible build environments
- Version detection from GitHub releases
This automation transforms what could be hours of manual work into a simple commit to update a YAML file.
The Developer Experience
Having my own package repositories has dramatically improved my development workflow:
Before:
# Install my tool
curl -L https://github.com/Fuabioo/dontrm/releases/latest/download/dontrm_linux_amd64.tar.gz | tar xz
sudo mv dontrm /usr/local/bin/
After:
# Homebrew (works on macOS and Linux)
brew tap fuabioo/tap
brew install dontrm
# APT (Linux only)
curl -fsSL https://apt.fuabioo.com/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/fuabioo.gpg
echo "deb [signed-by=/usr/share/keyrings/fuabioo.gpg] https://apt.fuabioo.com stable main" | sudo tee /etc/apt/sources.list.d/fuabioo.list
sudo apt update
sudo apt install dontrm
Looking Forward
This experience has given me a deep appreciation for the infrastructure that makes software distribution seamless. Every time I run brew install
or apt install
, I think about the complex machinery working behind the scenes.
Some ideas I’m exploring:
- Automated Formula Generation: Create Homebrew formulas directly from GitHub releases
- Multi-arch Support: Better ARM64 and other architecture support
- Package Metrics: Analytics on package downloads and usage
- Mirror Networks: CDN-backed distribution for better global performance
Try It Yourself
If you’re curious about package management, I encourage you to explore building your own repositories. Start small - maybe package one of your own tools for Homebrew. The Homebrew documentation is excellent, and the community is welcoming.
You can try installing tools from my repositories:
# Add my Homebrew tap
brew tap fuabioo/tap
# Install some tools
brew install dontrm fastfetch
# Or check out the APT archive
curl -fsSL https://apt.fuabioo.com/
Building these repositories taught me that package managers are more than just software installers - they’re the circulatory system of the software ecosystem, enabling developers to build on each other’s work seamlessly.
What started as a simple desire to make my tools easier to install became a deep dive into software distribution, automation, and developer experience. Sometimes the best way to understand a system is to build your own version of it.
Have you built your own package repositories or distribution systems? I’d love to hear about your experiences and the lessons you’ve learned along the way.