From c64db22afdf548d11e7da2176cc9b79ce2e7ade8 Mon Sep 17 00:00:00 2001 From: greigdp Date: Thu, 12 Dec 2024 20:13:32 +0000 Subject: [PATCH] Override PATH on MacOS to find borg bin. By @greigdp (#2166) --- src/vorta/borg/borg_job.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vorta/borg/borg_job.py b/src/vorta/borg/borg_job.py index b66acc2d..c23536bc 100644 --- a/src/vorta/borg/borg_job.py +++ b/src/vorta/borg/borg_job.py @@ -203,7 +203,13 @@ def prepare(cls, profile): @classmethod def prepare_bin(cls): """Find packaged borg binary. Prefer globally installed.""" - + # On MacOS, the PATH environment variable does not seem to be set when run as a pyinstaller binary. + # More info at https://github.com/borgbase/vorta/issues/2100 + # Set the path to also find homebrew installs of Borg, and avoid falling back to the embedded binary. + if sys.platform == 'darwin': + current_path = os.environ.get("PATH", "/usr/bin:/bin") + os.environ["PATH"] = f"{current_path}:/opt/homebrew/bin:/usr/local/bin" + # Now continue looking for the borg binary to use borg_in_path = shutil.which('borg') if borg_in_path: