1. Pre-requisites

Here is the list of components required to develop or compile rdiff-backup on macOS.

1.1. Installing Python on macOS

On macOS, you have two main options for installing Python.

Note
The universal2 format allows a single binary to run natively on both x86_64 (Intel) and arm64 (Apple Silicon M1,M2,M3) architectures. This is especially helpful when distributing Python scripts or applications across various Mac environments. https://en.wikipedia.org/wiki/Universal_binary#Universal_2

Visit the official Python downloads page for macOS:

  • Choose the installer labeled macOS 64-bit universal2 installer.

  • This version includes support for both Intel and Apple Silicon processors.

  • It installs Python under /usr/local/bin/python3 (you may need to update your PATH).

1.1.2. Option 2: Install via Homebrew

If you use Homebrew, you can install Python with:

On macOS, you have two main options to install Python:

  • Install via Homebrew: brew install python

1.1.3. Verify that Python was installed correctly:

which python3
python3 --version

1.2. Install Required Build Tools

You may need the following tools for building native libraries:

xcode-select --install

1.3. Build and Install librsync from Source

  1. Clone or download the librsync source from GitHub: https://github.com/rdiff-backup/librsync

  2. Build and install it:

wget https://github.com/librsync/librsync/releases/download/v2.3.4/librsync-2.3.4.tar.gz
tar zxvf librsync-2.3.4.tar.gz
cd librsync
cmake .
make
sudo make install

This should install librsync in /usr/local/lib and headers in /usr/local/include.

To confirm installation:

ls /usr/local/lib | grep rsync

2. Build, Test and Package rdiff-backup

Now you can clone and set up the rdiff-backup source tree:

git clone https://github.com/rdiff-backup/rdiff-backup
cd rdiff-backup

2.1. Create and Activate Virtual Environment

python3 -m venv .venv
source .venv/bin/activate

Ensure you’re using the virtual environment’s Python, verify that python3 is within the venv folder:

which python3

2.2. Set Library Path (for dynamic linker)

export DYLD_LIBRARY_PATH=/usr/local/lib

2.3. Install Dependencies and Editable Package

pip install -e .

This installs rdiff-backup in editable mode along with development dependencies.

2.4. Run Tests

make test

2.5. Build the Package

To build a source distribution and wheel:

pyproject-build

Artifacts will be created in the dist/ directory.

3. Troubleshooting

  • If Python cannot find librsync, make sure DYLD_LIBRARY_PATH is exported properly.

  • Use otool -L dist/rdiff-backup to inspect dynamic library dependencies.