Homebrew Formula
This document explains how to use, test, and submit the Homebrew formula for Pass-CLI.
Overview
The Homebrew formula enables easy installation of Pass-CLI on macOS and Linux systems through the Homebrew package manager.
Formula Location
- Formula File:
homebrew/pass-cli.rb - Purpose: Distribution via Homebrew tap or official Homebrew repository
Installation for Users
From a Tap (Recommended for Testing)
# Add the tap
brew tap arimxyer/homebrew-tap
# Install Pass-CLI
brew install pass-cliFrom Official Homebrew (After Submission)
brew install pass-cliSetting Up a Homebrew Tap
A Homebrew tap is a GitHub repository that contains Homebrew formulae.
1. Create the Tap Repository
# Create a new repository on GitHub named: homebrew-pass-cli
# The naming convention is important: homebrew-<tapname>2. Initialize the Tap Repository
# Clone your new repository
git clone https://github.com/arimxyer/homebrew-tap.git
cd homebrew-tap
# Create Formula directory
mkdir -p Formula
# Copy the formula
cp /path/to/pass-cli/homebrew/pass-cli.rb Formula/
# Commit and push
git add Formula/pass-cli.rb
git commit -m "Add Pass-CLI formula"
git push origin main3. Update SHA256 Checksums
After creating a release, you need to update the SHA256 checksums in the formula:
# Download each release artifact and calculate its checksum
curl -L "https://github.com/arimxyer/pass-cli/releases/download/v0.0.1/pass-cli_0.0.1_darwin_amd64.tar.gz" | sha256sum
# Repeat for each platform:
# - darwin_amd64
# - darwin_arm64
# - linux_amd64
# - linux_arm64
# Update the sha256 values in the formulaTesting the Formula
Local Testing
# Install from local formula file
brew install --build-from-source homebrew/pass-cli.rb
# Or use brew install with the tap
brew install --debug --verbose arimxyer/homebrew-tap/pass-cli
# Test the installation
pass-cli version
pass-cli --help
# Run formula tests
brew test pass-cli
# Uninstall for re-testing
brew uninstall pass-cliAudit the Formula
Before submission, audit the formula to ensure it meets Homebrew standards:
# Check formula style and best practices
brew audit --new-formula pass-cli
# Strict audit (recommended before submission)
brew audit --strict --online pass-cli
# Style check
brew style pass-cliTest Installation on Multiple Platforms
Test on all supported platforms:
- macOS Intel (x86_64)
- macOS Apple Silicon (arm64)
- Linux Intel (x86_64)
- Linux ARM (aarch64)
Submitting to Official Homebrew
Prerequisites
- Stable Release: Must have a stable version with release artifacts
- Open Source: Must have an OSI-approved license (MIT [PASS])
- Notable Project: Should have some community adoption
- Documentation: README, LICENSE, and proper documentation
Submission Process
Fork the Homebrew Repository
gh repo fork homebrew/homebrew-core --clone cd homebrew-coreCreate a New Branch
git checkout -b pass-cliAdd Your Formula
cp /path/to/pass-cli/homebrew/pass-cli.rb Formula/Test Thoroughly
brew install --build-from-source Formula/pass-cli.rb brew test pass-cli brew audit --strict --online pass-cliCreate Pull Request
git add Formula/pass-cli.rb git commit -m "pass-cli 0.0.1 (new formula)" git push origin pass-cli # Create PR on GitHub gh pr create --title "pass-cli 0.0.1 (new formula)" \ --body "Secure CLI password manager with AES-256-GCM encryption"
PR Requirements
Your submission must include:
- Formula file in
Formula/pass-cli.rb - Working installation test
- All audits passing
- Accurate description and homepage
- Valid license
- SHA256 checksums for all platforms
- Commit message format:
pass-cli 0.0.1 (new formula)
Updating the Formula
When releasing a new version:
Update Version Number
version "1.1.0"Update URLs
url "https://github.com/arimxyer/pass-cli/releases/download/v1.1.0/..."Update SHA256 Checksums
- Download new release artifacts
- Calculate new checksums
- Update formula
Test the Update
brew upgrade pass-cli brew test pass-cliSubmit PR (if in official Homebrew)
git checkout -b pass-cli-1.1.0 git add Formula/pass-cli.rb git commit -m "pass-cli 1.1.0" git push origin pass-cli-1.1.0 gh pr create
Automated Updates
Consider adding automation to update checksums:
# Example script to calculate checksums
#!/bin/bash
VERSION="0.0.1"
BASE_URL="https://github.com/arimxyer/pass-cli/releases/download/v${VERSION}"
for os in darwin linux; do
for arch in amd64 arm64; do
URL="${BASE_URL}/pass-cli_${VERSION}_${os}_${arch}.tar.gz"
echo "Downloading ${os}_${arch}..."
SHA=$(curl -sL "$URL" | shasum -a 256 | cut -d' ' -f1)
echo "${os}_${arch}: ${SHA}"
done
doneFormula Best Practices
Do’s
- [OK] Use stable release URLs (not
latest) - [OK] Include accurate SHA256 checksums
- [OK] Support all relevant platforms
- [OK] Include meaningful tests
- [OK] Add shell completion generation
- [OK] Provide helpful caveats for first-time users
- [OK] Keep formula simple and maintainable
Don’ts
- [ERROR] Don’t use
latesttag in URLs - [ERROR] Don’t skip checksums
- [ERROR] Don’t include build-time patches without good reason
- [ERROR] Don’t add unnecessary dependencies
- [ERROR] Don’t use deprecated Homebrew DSL features
Troubleshooting
Checksum Mismatch
# Recalculate the checksum
curl -sL "YOUR_URL" | shasum -a 256Installation Fails
# Check detailed logs
brew install --verbose --debug pass-cli
# Check formula syntax
brew audit pass-cliFormula Rejected
- Review Homebrew’s Acceptable Formulae
- Check Formula Cookbook
- Ensure all tests pass
- Follow reviewer feedback
Resources
- Homebrew Formula Cookbook
- Homebrew Acceptable Formulae
- How to Create and Maintain a Tap
- Ruby Formula DSL
- Homebrew GitHub
Support
For issues with the formula:
- Check the Homebrew documentation
- Review existing Homebrew PRs
- Ask in Homebrew Discussions
- File an issue in the pass-cli repository
Maintenance Checklist
For maintainers updating the formula:
- Update version number
- Update all platform URLs
- Calculate and update all SHA256 checksums
- Test installation on macOS (Intel and ARM)
- Test installation on Linux
- Run
brew audit --strict --online pass-cli - Run
brew test pass-cli - Update tap repository (if applicable)
- Submit PR to homebrew-core (if applicable)
- Tag release in pass-cli repository
- Update release notes