woodruffw / ff2mpv

A Firefox/Chrome add-on for playing URLs in mpv.
https://addons.mozilla.org/en-US/firefox/addon/ff2mpv/
Other
521 stars 52 forks source link

Can't use ff2mpv on MacOS #89

Closed apricot23 closed 2 years ago

apricot23 commented 2 years ago

Describe the bug

I have been trying for a while to get ff2mpv to run on my Mac. I installed the native client and I thought it could be a problem with the path but it seems to be an issue with executing the script on an OS level.

Reproduction steps

Steps to reproduce the behavior:

  1. While a YouTube link is open, click the ff2mpv extension icon on Firefox. (Or right click on another link via context menu).
  2. No visible response, nothing opens. No response in the Firefox console under Inspect Element. However, if I filter "ff2mpv" in the MacOS Console app, I see an error:

Sandbox: Python(29759) System Policy: deny(1) file-read-data /Users/[REDACTED]/Documents/misc/ff2mpv/ff2mpv.py

Expected behavior

mpv should launch and does not. It seems like the script does not get a chance to start.

Screenshots (optional)

Screen Shot 2022-09-07 at 10 50 44 PM

Platform information

Additional context (optional)

I installed the native client using install.sh. I also tried editing the json config file to use the Ruby executable instead of Python, but the issue is identical except the Sandbox error in Console says Ruby instead of Python.

I tried providing "Full Disk Access" to Firefox in System Preferences and the issue persists also.

woodruffw commented 2 years ago

Thanks for the report.

Which Python and Ruby interpreters are you using? I wonder if the system-provided ones have been locked down even further in recent versions of macOS.

woodruffw commented 2 years ago

(Also, thank you for following the bug report steps precisely! It's a terrific help when people do that.)

apricot23 commented 2 years ago

Thanks for the report.

Which Python and Ruby interpreters are you using? I wonder if the system-provided ones have been locked down even further in recent versions of macOS.

Python interpreter is CPython and it's version 3.10.6. I use Homebrew frequently to install stuff so I don't think it's system-provided if I'm understanding you correctly

Not sure how to determine the Ruby interpreter but when I check the version it says "ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]"

woodruffw commented 2 years ago

Hmm, could you run each of these?

which ruby
which python
which python3

If those point to /usr/bin instead of /usr/local/bin (or whatever your brew --prefix is), then they're the system provided versions.

It's also possible that my previous hack:

https://github.com/woodruffw/ff2mpv/blob/1f6cfc480270ef2c8eae81a37d470251b5d2cf31/ff2mpv.py#L22-L31

...is no longer good enough, since I believe Homebrew no longer installs to /usr/local by default.

apricot23 commented 2 years ago
$ which ruby
/usr/bin/ruby
$ which python
/usr/local/opt/python/libexec/bin/python
$ which python3
/usr/local/bin/python3
$ brew --prefix
/usr/local

Seems like Ruby is the system version which makes sense to me.

woodruffw commented 2 years ago

Hmm, I think I know what's going on here -- it looks like 10.15 and newer add additional sandbox restrictions to ~/Desktop and ~/Documents. Could you try putting the native client in another location (maybe something like ~/bin?) and updating the path in the config?

apricot23 commented 2 years ago

Thank you so much! This worked perfectly. Everything's good now.

woodruffw commented 2 years ago

Glad to hear it, and thanks again for reporting!

If you'd like, please feel free to add your experience to the "Common Problems" wiki page: https://github.com/woodruffw/ff2mpv/wiki/Common-problems