Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can not use youtube-dl on M1 Mac - env: python: No such file or directory

When I try to run YouTube-dl from the terminal on my M1 MacBook Air, I get the following message:

env: python: No such file or directory.


I have re-installed Python and can use it through the IDLE app.


I have followed suggestions to try:

sudo ln -s /usr/bin/python3 /usr/bin/python


This gives the message:

ln: /usr/bin/python: Operation not permitted


I would appreciate any help.

MacBook Air (2020 or later)

Posted on Mar 28, 2022 12:32 PM

Reply
Question marked as Top-ranking reply

Posted on May 28, 2022 1:30 PM

A three things to check since I know nothing about YouTube-dl. EIther one will prevent it from working:


  1. YouTube-dl may not be Python 3 compatible and that will end things abruptly.
  2. The application may expect the presence of Apple's Python-Objective-C bridge and that will not be present after Apple removed Python 2.7.18 from Monterey 12.3.1. It won't be present in any Python3 distribution either. Result: dead script.
  3. Timothyong's comments about a Bash dependency by YouTube-dl.



Similar questions

8 replies
Question marked as Top-ranking reply

May 28, 2022 1:30 PM in response to jdbartram

A three things to check since I know nothing about YouTube-dl. EIther one will prevent it from working:


  1. YouTube-dl may not be Python 3 compatible and that will end things abruptly.
  2. The application may expect the presence of Apple's Python-Objective-C bridge and that will not be present after Apple removed Python 2.7.18 from Monterey 12.3.1. It won't be present in any Python3 distribution either. Result: dead script.
  3. Timothyong's comments about a Bash dependency by YouTube-dl.



Apr 11, 2022 1:44 PM in response to jdbartram

Did you ever figure this out? I wrestled with it for hours in March. I eventually found a site that explained to update Python using "brew" commands, but that still didn't work until I found a comment to put the YouTube address in single quotes:


youtube-dl 'link goes here'


and that worked for that session. I just came back to it today and cannot get it to work at all. Again, same error messages. It's maddening when Apple makes a change to the OS that breaks things like this.

Apr 12, 2022 1:21 PM in response to BuckeyeRay

BuckeyeRay,


I got this suggestion on Github,


"Review this SO thread https://stackoverflow.com/questions/36730549/cannot-create-a-symlink-inside-of-usr-bin-even-as-sudo."


But I was unable to make it work, and I don't want to disable System Integrity Protection, which was one of the suggestions.


I have another laptop with Linux installed on it, and YouTube-dl works fine on it, so I will forget about it on my Mac. It's annoying of course.

Apr 12, 2022 3:03 PM in response to jdbartram

Apple removed the Python 2.7.18 distribution from macOS 12.3. You can install the full Python 3.10.4 distribution which will install in /Library/Frameworks/Python.framework and as a folder in your Applications. It also links its binaries idle3, pip3, python3 into /usr/local/bin. You can access these once you alter the PATH in your shell startup file:


export PATH="$HOME:/usr/local/bin:${PATH}"



Then you can access the Python3 interpreter from the Terminal prompt, or from scripts that use the following first line:


!#/usr/bin/env python3


You can also reinstall the deprecated Python 2.7.18 from the above link, and it will link its binaries idle, pip2, and python into /usr/local/bin. I have done this on macOS 12.3 and both versions of Python live comfortably in that /Library/Frameworks/Python.framework/Versions location. A Python 2.7 folder is also added to Applications.


I do not recommend linking Python3 to a Python namespace.

May 27, 2022 2:46 AM in response to jdbartram

Maybe changing your terminal's shell from zsh to bash will work. It worked for me.

Here's the terminal that changes your terminal from zsh to bash: chsh -s /bin/bash

Also, adding quotation in front of the link might help, it looks like this: youtube-dl 'your URL goes here'

hope this helps

source: https://superuser.com/questions/649635/zsh-says-no-matches-found-when-trying-to-download-video-with-youtube-dl

https://www.howtogeek.com/444596/how-to-change-the-default-shell-to-bash-in-macos-catalina/

Can not use youtube-dl on M1 Mac - env: python: No such file or directory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.