Skip to content

Commit

Permalink
Override PATH on MacOS to find borg bin. By @greigdp (#2166)
Browse files Browse the repository at this point in the history
  • Loading branch information
greigdp authored Dec 12, 2024
1 parent fcc53e9 commit c64db22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vorta/borg/borg_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c64db22

Please sign in to comment.