Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

f54da

macrumors 6502a
Original poster
Dec 22, 2021
627
227
Just a heads up that yt-dlp no longer supports 10.9.

One option of course is installing a more recent python version using macports & pip installing it, but that brings with it a lot of macports baggage and is definitely not a "user friendly" solution. I remember @Wowfunhappy bootstrapped a standalone python3.10 release, do you happen to have a link to that somewhere? If the python binary can be run standalone without needing to entangle it into the system (esp. for people who already have too many copies of python around and don't want to break their existing setup), I think downloading the "platform independent zipimport" binary and then using that with self-contained python3.10 should work.

Of course python 3.10 itself is fairly old, and is probably going to be dropped by yt-dlp sometime next year I think... macports seems to have newer python working as far back as snow leopard, can those be extracted and used in a standalone fashion?
 
On https://mavericksforever.com/#media, both "Media Subscriptions" and "Download Video Service", which use yt-dlp under the hood, ship with a standalone embedded copy of Python 3.10. (I started using yt-dlp before they offered legacy macos builds, and once they did start offering legacy builds, I did not switch because I figured they would eventually drop Mavericks support.)

----------

Now the question is, how did I produce the embedded copy of Python 3? Unfortunately, I built this all the way back in 2021 and did not keep detailed notes, all I have written down is:

Code:
On a 10.6 VM with MacPorts installed:

./configure MACOSX_DEPLOYMENT_TARGET=10.6 --prefix=/Users/Jonathan/Desktop/python-build --with-openssl=/opt/local/libexec/openssl3/

dylibbundler --no-codesign -p '@executable_path/../lib' -d lib -b -x lib/python3.10/lib-dynload/_ssl.cpython-310-darwin.so

Which I think implies that Python 3 actually compiles into this type of portable configuration by default.

I then appear to have also manually zipped the lib/python3.10 folder, presumably to keep the number of files under control so the bundle won't take forever to copy places. I think I discovered that this was possible by chance, I can't find documentation on it anywhere. It doesn't quite work for all python packages—I still have a separate non-zipped python3.10 folder with a handful of site packages—but it still dramatically reduces the file count.

---

If you just want a copy of Python 3.10 that can be installed system-wide without MacPorts, that's also on Mavericks Forever, currently in the App Library → More Stuff → Command Line Software. (I may reorganize this in the future, I'm not happy with how buried it is currently.) Unlike the embedded copy, I have detailed build instructions for this one!

At some point I will have to figure out how to compile newer copies of Python but I'm hoping I don't have to deal with this for a while. I've consistently had issues enabling working SSL support.
 
Last edited:
Of course python 3.10 itself is fairly old, and is probably going to be dropped by yt-dlp sometime next year I think... macports seems to have newer python working as far back as snow leopard, can those be extracted and used in a standalone fashion?
On a Mavericks install, install MacPorts, then install the python version you want. Then, use
Code:
sudo port mpkg $python
where $python is the python version you want. You'll end up with a .mpkg file inside /opt/local/var/macports/build. It should be in the largest folder, and it should be the largest package file. I forget the exact naming scheme but it will include python in it.

With that, you can then copy and install that onto another machine. You do not need to have macports installed on that machine, the mpkg is self-contained and has all the necessary dependencies. Just ensure that your path is setup correctly to access the right python.

You could do this with the yt-dlp port as well, it should bundle the entire python as well, but then you'll need to do that for every new release as opposed to using pip.
 
That is neat! Thanks for the link, I'll use the self-contained version from there.

@Wowfunhappy do you also recall why you opted to rebuild python from scratch instead of "packaging" up macports python like mentioned above?
 
@Wowfunhappy do you also recall why you opted to rebuild python from scratch instead of "packaging" up macports python like mentioned above?

Because:
  • If you do have MacPorts installed the package could potentially interfere with that.
  • If you don’t have MacPorts installed, it’s messy to add an extra top-level folder (opt) to your startup disk just for Python.
  • The Preference Pane and Service are supposed to be fully self-contained, without depending on anything installed elsewhere.
The first and last only apply to the Service / PrefPane, but the second point is the reason I also recompile Python 3 itself.

I really appreciate MacPorts but I basically never use the package functionality, if I was to repackage something from MacPorts I would use dylibbundler.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.