yt-dlp: On MAC: On the same call, when providing the update and arguments to download the video, the download fails
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
- I understand that I will be blocked if I intentionally remove or skip any mandatory* field
Checklist
- I’m asking a question and not reporting a bug or requesting a feature
- I’ve looked through the README
- I’ve verified that I have updated yt-dlp to nightly or master (update instructions)
- I’ve searched known issues and the bugtracker for similar questions including closed ones. DO NOT post duplicates
- I’ve read the guidelines for opening an issue
Please make sure the question is worded well enough to be understood
by calling yt-dlp in mac, I got this issue and upfront to open a bug report, i wanna be sure.
This happens only on MAC. On Windows and Linux it works fine. On the same call, when providing the update and arguments to download the video, the download fails example
yt-dlp --update-to master -S vcodec:h264,res,acodec:aac <URL_of_the_video> -P "F:/Videos/" -o "My Title.mp4"
- it checks for the update
- if founded: – it updates itself then – it stops without re-run itself and going ahead to execute the arguments given to download the video.
- if not founded: – it goes ahead normally by downloading the video as requested
Provide verbose output that clearly demonstrates the problem
- Run your yt-dlp command with -vU flag added (
yt-dlp -vU <your command line>) - If using API, add
'verbose': TruetoYoutubeDLparams instead - Copy the WHOLE output (starting with
[debug] Command-line config) and insert it below
Complete Verbose Output
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 55 (15 by maintainers)
@pms967 is correct, and to expand on what was said:
yt-dlp(the zipimport executable product ofmake) does not unpack its contents to /tmp, like howyt-dlp_macos(the pyinstaller-bundled executable) needs to do. The needed unpacking is known to be the cause of the slowdown (again, to be discussed in #10425), and I wouldn’t be surprised it’s the cause of the post-update restart failure as well.To recenter on the original problem as stated by @Grub4K, one more info : the problem does not happen when using a checkout of the github project. On my machine, if I git clone the repository, cd into it, make it and launch :
Then yt-dlp restarts correctly after update and starts the download, when the yt-dlp_macos binary provided in the releases doesn’t.
This is being tracked in a separate issue as well: #11355
I asked a couple questions to try to investigate the issue but didn’t get an answer for either of them.
Please keep the discussion in this issue on-topic or else it will be locked
Allow application from is set to “App Store & Known Developers” on my machine. I am on macOS Sequoia 15.1.
There have been occasional reports of insanely long startup times on macOS, likely due to gatekeeper. I was never able to reproduce these either.
Thank you for the explanation. However even with these steps I can not replicate on my machine. I also do not get asked for authorization by macos. Potentially this is some security mechanism by Apple, but until another dev can reproduce this will be difficult to debug and fix.
Though it’s also notable that the zip build uses a different code path for updating than the pyinstaller exe’s do:
https://github.com/yt-dlp/yt-dlp/blob/282e19db827f0951c783ac946429f662bcf2200c/yt_dlp/update.py#L462-L521
And the rest of the relevant code, in case anyone wants to try to craft a non-yt-dlp MRE to be built with pyinstaller:
https://github.com/yt-dlp/yt-dlp/blob/282e19db827f0951c783ac946429f662bcf2200c/yt_dlp/__init__.py#L1001-L1004
https://github.com/yt-dlp/yt-dlp/blob/282e19db827f0951c783ac946429f662bcf2200c/yt_dlp/update.py#L537-L542
https://github.com/yt-dlp/yt-dlp/blob/282e19db827f0951c783ac946429f662bcf2200c/yt_dlp/utils/_utils.py#L836-L911
@BenTalagan
Yeah, because (differently from yt-dlp_macos) this contains only the Python code of yt-dlp, and rely on a Python interpreter already installed on the system. Of course it won’t run if a viable version of Python3 can’t be found.
there’s no perceivable delay or slowness WRT the same command run manually from the command line. But that’s expected, since the delay is a specific Mac-only problem.
I think this is true, this discussion is derailing into something thats not related to the original issue anymore. Please keep it on track with the issue at hand, the MacOS build not restarting properly after auto-updating. The additional posts makes it hard to properly find information related to the issue.
PS: Maybe discussion on the discord or some private channel would be more appropriate for solving the lua issue. Also for windows you should not use
startat all if possible.To summarize: The MacOS build exits instead of restarting itself, which results in an error code of 247.
Current open investigation points:
@pms967 thanks for the suggestion ! Unfortunately, I think @tormyvancool’s requirements were to be able to do everything in one call for other reasons (yt-dlp is called inside a lua script which uses os.execute and the way yt-dlp outputs the logs does trigger some problems, but here it’s not my part anymore 😃 )
@seproDev regarding the authorizations, maybe you’ve authorized your system to launch applications coming from any developer ?
This can be checked in Settings > Privacy & Security > Allow apps from anywhere
Normally, this option cannot be enabled through the UI, it is hidden and is triggered by :
sudo spctl --master-disableStandard users generally don’t have this option on, but only trust the app store and “identified developers”.
Anyway, I’ve changed this parameter on my own machine and remade the test. It effectively disables the authorization popup (so we spare the auth step), but the rest of the problem is the same, on the first launch yt-dlp updates itself, says it’s going to restart to perform the download of the video, but it’s not restarting. (The last log line is the one starting with “[debug] Restarting: etc”). The command needs to be launched again for that.
For info right now I’m testing on Ventura 13.6.3.
Hi I’m jumping in the discussion because it’s not productive. What Tormy is actually posting are the results of a common debugging session, he’s not working under macos but asks me to launch some commands and as posted the results here so the information is not formatted correctly and hardly understandable.
Regarding the
yt-dlp ./yt-dlp_macosstuff, the first part is just the prompt of my shell (it was the name of the folder where the yt-dlp_macos binary was located).Please, make abstraction of what’s been posted precedently and follow these simple steps. From a macos terminal :
./yt-dlp_macos --update-to master -S vcodec:h264,res,acodec:aac "https://www.youtube.com/watch?v=9pZUokleIf0" -o "test.mp4" -v(at this point macos asks for authorizations, that you should give from the preferences panel)
Re-launch the command. You will get the following output :
It stops here, yt-dlp_macos is now up to date, but the restart is not effective. The command needs to be launched again manually to launch the download, while yt-dlp_macos says it’s restarting.
Basically, that’s what Tormy is complaining about.