Skip to content

Instantly share code, notes, and snippets.

@benfry
Last active April 30, 2021 22:05
Show Gist options
  • Save benfry/6c9b319bf1b5a0a3a1c47cb1c275ade4 to your computer and use it in GitHub Desktop.
Save benfry/6c9b319bf1b5a0a3a1c47cb1c275ade4 to your computer and use it in GitHub Desktop.
How to compile and install rsync on macOS
# Compile rsync 3.2.3
Follow these instructions in Terminal on both the client and server to download and compile rsync on macOS
# Download and unarchive rsync and its patches
cd ~/Desktop
curl -O https://rsync.samba.org/ftp/rsync/src/rsync-3.2.3.tar.gz
curl -O https://rsync.samba.org/ftp/rsync/src/rsync-patches-3.2.3.tar.gz
tar xvfz rsync-3.2.3.tar.gz
tar xvfz rsync-patches-3.2.3.tar.gz
cd rsync-3.2.3
# Apply patches relevant to preserving Mac OS X metadata
patch -p1 <patches/fileflags.diff
# looks like crtimes was moved to master:
# https://github.com/WayneD/rsync-patches/commit/f6849a44b46a8b422438fd6fd2b4cd739a90c244
#patch -p1 <patches/crtimes.diff
# No longer work, patch contains:
# "$$$ERROR$$$ the old patch needs reworking since rsync_xal_get() has totally changed!"
#patch -p1 <patches/hfs-compression.diff
# make use openssl can be found (install first with Homebrew)
#export LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/lib"
#export CFLAGS="-I/usr/local/opt/openssl/include/ -I/usr/local/include"
#export CPPFLAGS="-I/usr/local/opt/openssl/include/ -I/usr/local/include"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
# alternate version, these didn't work either
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-static -I/usr/local/opt/openssl/include"
# Configure, make, install
./prepare-source
./configure
make
# don't use sudo if mixing with a Homebrew install
make install
#Verify your installation
/usr/local/bin/rsync --version
#By default, rsync will be installed in /usr/local/bin.
#If that isn't in your path, you will need to call your new version of rsync by its absolute path (/usr/local/bin/rsync).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment