Install Borg Backup from Source on Mac OS X

Install Borg Backup from Source on Mac OS X

Due to Borg Issue #913 brew cask install borgbackup is no longer updated with the latest version. However don’t fear I’ve written this guide on installing Borg Backup from Source on Mac OS X.

The easiest way is to save this script, chmod u+x install-borg.sh and then ./install-borg.sh in the directory you wish. I have a directory ~/backup-system with notes and scripts. You will need Homebrew.

#!/usr/bin/env bash
#requires homebrew
#See https://borgbackup.readthedocs.org/en/stable/installation.html for more info
brew install python3 lz4 openssl
pip3 install --upgrade pip
pip3 install virtualenv

virtualenv --python=python3 borg-env
source borg-env/bin/activate

# install Borg + Python dependencies into virtualenv
pip install borgbackup
ln -s $(pwd)/borg-env/bin/borg /usr/local/bin/borg

This script can be used to upgrade Borg. Save this script as upgrade-borg.sh, place into the same folder as install-borg.sh and chmod u+x upgrade-borg.sh

#!/usr/bin/env bash
source borg-env/bin/activate

pip install -U borgbackup

Slightly longer way:
You’ll need to run these commands to install some software that it needs,

brew install python3 lz4 openssl
pip3 install --upgrade pip
pip3 install virtualenv

Then create a python virtual enviroment, change into it using the activate script and then install borg.

virtualenv --python=python3 borg-env
source borg-env/bin/activate

# install Borg + Python dependencies into virtualenv
pip install borgbackup

We will need to symlink the our copy of borg into a directory that exists in $PATH so we can run it with just borg otherwise we would need to use source borg-env/bin/activate each time we wanted to run borg.

ln -s $(pwd)/borg-env/bin/borg /usr/local/bin/borg

If you want to upgrade borg the long way run:

source borg-env/bin/activate
pip install -U borgbackup

However it’s easier to just use the scripts above.

Source

One thought on “Install Borg Backup from Source on Mac OS X

  1. Now brog homebrew seem updated, current version in homebrew is 1.0.10, it is last stable version.

Leave a Reply

Your email address will not be published. Required fields are marked *