Skip to content

macOS: Fix yt-dlp launch through mpv - #791

Open
Et0h wants to merge 1 commit into
masterfrom
macOS-ytdlp-fix
Open

macOS: Fix yt-dlp launch through mpv#791
Et0h wants to merge 1 commit into
masterfrom
macOS-ytdlp-fix

Conversation

@Et0h

@Et0h Et0h commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This is a fix inspired by #785 to address #585 and is hopefully more reliable.

This PR removes deprecated handling for youtube-dl on macOS and updates environment variable management for mpv subprocesses.

Removed deprecated handling for youtube-dl on macOS and updated environment variable management for mpv subprocesses.
@Et0h
Et0h requested a review from albertosottile August 2, 2026 19:06
Comment thread syncplay/players/mpv.py
env.pop('PYTHONPATH', None)

# Add common executable locations while preserving inherited PATH entries.
macPaths = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this necessary?

@Et0h Et0h Aug 9, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to address the macOS yt-dlp/mpv problem discussed in #585 and #785, while making the fix work more universally rather than depending on a particular yt-dlp/Python installation.

For context, I'm doing my best to get something workable while not being a macOS user let alone developer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know what you're trying to accomplish, I authored that PR :)
my question is about the addition in this PR relative to mine (extending PATH with 'common' paths) - what makes you think PATH is not sufficiently populated therefore needs to be extended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair question. The PATH change isn't needed for the "PYTHONHOME"/"PYTHONPATH" fix itself. I added it because removing the old workaround also removes its explicit "/opt/homebrew/bin:/usr/local/bin:/usr/bin" PATH handling.

My concern is the normal DMG/Finder-launched use case: py2app documents that applications launched normally get a minimal environment and don't pick up changes from the user's shell profile. This was also discussed in #276, where it was noted that macOS GUI apps may not have "/usr/local/bin" in PATH and the suggestion was to append it rather than replace the existing PATH.

So the intention was to preserve the old code's ability to find a Homebrew-installed downloader, while avoiding overwriting any PATH that is already present. "/opt/homebrew/bin" covers current Apple Silicon Homebrew and "/usr/local/bin" covers Intel Homebrew.

On reflection, I think the patch can be narrower here: rather than adding all of the standard system paths, it could just preserve the inherited PATH and append "/opt/homebrew/bin" and "/usr/local/bin" if missing.

What's your thoughts on it being tweaked to:
if isMacOS():
env.pop('PYTHONHOME', None)
env.pop('PYTHONPATH', None)

# Add common Homebrew locations while preserving inherited PATH entries.
pathEntries = [path for path in env.get('PATH', '').split(os.pathsep) if path]
for path in ['/opt/homebrew/bin', '/usr/local/bin']:
    if path not in pathEntries:
        pathEntries.append(path)
env['PATH'] = os.pathsep.join(pathEntries)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants