Skip to content

Commit

Permalink
native clients: flip brew paths
Browse files Browse the repository at this point in the history
See #124.
  • Loading branch information
woodruffw committed May 4, 2024
1 parent 4585f17 commit f57d39b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ff2mpv
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ args.push(*options)

# HACK(ww): On macOS, graphical applications inherit their path from `launchd`
# rather than the default path list in `/etc/paths`. `launchd` doesn't include
# `/usr/local/bin` in its default list, which means that any installations
# Homebrew in its default list, which means that any installations
# of MPV and/or youtube-dl under that prefix aren't visible when spawning
# from, say, Firefox. The real fix is to modify `launchd.conf`, but that's
# invasive and maybe not what users want in the general case.
# Hence this nasty hack.
ENV["PATH"] = "/usr/local/bin:/opt/homebrew/bin:#{ENV['PATH']}" if RUBY_PLATFORM =~ /darwin/
ENV["PATH"] = "/opt/homebrew/bin:/usr/local/bin:#{ENV['PATH']}" if RUBY_PLATFORM =~ /darwin/

pid = spawn "mpv", *args, "--", url, in: :close, out: "/dev/null", err: "/dev/null"

Expand Down
4 changes: 2 additions & 2 deletions ff2mpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ def main():

# HACK(ww): On macOS, graphical applications inherit their path from `launchd`
# rather than the default path list in `/etc/paths`. `launchd` doesn't include
# `/usr/local/bin` in its default list, which means that any installations
# Homebrew in its default list, which means that any installations
# of MPV and/or youtube-dl under that prefix aren't visible when spawning
# from, say, Firefox. The real fix is to modify `launchd.conf`, but that's
# invasive and maybe not what users want in the general case.
# Hence this nasty hack.
if platform.system() == "Darwin":
path = os.environ.get("PATH")
os.environ["PATH"] = f"/usr/local/bin:/opt/homebrew/bin:{path}"
os.environ["PATH"] = f"/opt/homebrew/bin:/usr/local/bin:{path}"

subprocess.Popen(args, **kwargs)

Expand Down

0 comments on commit f57d39b

Please sign in to comment.