Skip to content

Instantly share code, notes, and snippets.

@e40
Last active June 7, 2026 18:33
Show Gist options
  • Select an option

  • Save e40/caa67c1b8d439a528695f996d0519d8e to your computer and use it in GitHub Desktop.

Select an option

Save e40/caa67c1b8d439a528695f996d0519d8e to your computer and use it in GitHub Desktop.
How to pin rsync to version 3.4.1 in Homebrew on macOS
# 1. Setup your local bare backup repository with 'main' as the default branch
mkdir -p ~/src/local-taps-backup/local-rsync.git
cd ~/src/local-taps-backup/local-rsync.git
git init --bare
git symbolic-ref HEAD refs/heads/main
# 2. Prevent Homebrew from auto-updating mid-setup and create the new tap
export HOMEBREW_NO_AUTO_UPDATE=1
brew tap-new my-custom-taps/local-rsync
# 3. Pull down homebrew/core, extract rsync 3.4.1, and immediately reclaim the ~1.3GB of space
brew tap --force homebrew/core
brew extract --version=3.4.1 rsync my-custom-taps/local-rsync
brew untap homebrew/core
# 4. Move into the custom tap and rename the formula file to act as a global dependency provider
cd $(brew --repo my-custom-taps/local-rsync)
mv Formula/rsync@3.4.1.rb Formula/rsync.rb 2>/dev/null || mv rsync@3.4.1.rb rsync.rb
# 5. Modify the internal Ruby formula variables
export HOMEBREW_EDITOR=vi
brew edit my-custom-taps/local-rsync/rsync
# INSIDE VI:
# - Change the first line to: class Rsync < Formula Rsync
# - Change the url line to: url "https://download.samba.org/pub/rsync/src/rsync-3.4.1.tar.gz"
# - Delete the two "mirror" lines entirely
# 6. Normalize the tap's Git configuration, commit your files, and link it to your backup repo
git branch -m master main 2>/dev/null || true
git add .
git commit -m "Configure local rsync 3.4.1 as primary dependency provider"
git remote add origin ~/src/local-taps-backup/local-rsync.git
git push -u origin main
# 7. Safely uninstall the official core version of rsync (ignoring dependencies)
brew uninstall --ignore-dependencies rsync 2>/dev/null || true
# 8. Force Homebrew to look locally on your disk to install and link your custom version
HOMEBREW_NO_INSTALL_FROM_API=1 brew install my-custom-taps/local-rsync/rsync
brew unlink rsync && brew link rsync
brew untap homebrew/core
rsync --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment