Pymac: Command line tool to install and manage Python.org Mac installations

A few months ago pyenv had troubles compiling Python on my Mac, so I tried out the Mac installer from Python.org for the first time. I thought those installers are nice, but they do a few things I don’t like (like installing extras like GUI applications by default or requiring to manually run a command after install to set up SSL certificates). I wished there was a convenient command line tool for downloading, installing and managing Python-dot-org Pythons that fixes those things.

So I ended up writing pymac. This is basically a combination of various bash scripts that I have been using separately for a few weeks. I thought they might be usefu for others too, so I put them together and added a nice CLI interface. Core features:

  • Download and install Python-dot-org versions entirely from the command line
  • Installs only the basics (Python itself, Pip, and SSL certificates), not extras like GUI applications
  • Picks the latest known Python micro versions for you if you don’t provide one
  • Integrates with pyenv in the sense that it enables you to manage Python versions installed with Python-dot-org installers like normal pyenv installs
  • Provides various conveniences to manage Python-dot-org installations (e.g. setting default Python version, directly executing a specified version, updating to latest known micro versions)
4 Likes

Could you list more specifically what components of the official Python.org distribution are and are not installed? I looked through your readme and repository and couldn’t find such. Just FYI, what some consider “extra”, others may consider “essential”, so at the very least it is good to be clear and explict.

It’s in the Reame under “How it works”, I should probably make this more prominent:

pymac customizes the installation so that only Python itself and Pip are installed. The following additional features of the Python.org installer are excluded: GUI Applications, UNIX command line toos, Python Documentation, Shell profile updater.

‘GUI applications’ adds a directory in /Applications with the PyLauncher, some scripts and a shortcut to IDLE. ‘UNIX command line tools’ adds symlinks to /usr/local/bin, and ‘Shell profile updater’ will add a line to your shell config that prepends the installed Python version to your PATH.

Good point, I will update the README to use the more neutral term “other features” instead of “extras”.

I added a section about excluded features to the README: GitHub - sbaack/pymac: Install and manage macOS Python.org installers from the command line.

1 Like

Interesting! I made a similar thing for Windows a while back: GitHub - uranusjr/pythonup-windows: The Python Runtime Manager for Windows

The Mac installers have a lot more restrictions than Windows ones (they need to be installed with root access IIRC), and it’s been a hurdle I’ve never managed to get over and stuck to pyenv the last time I needed to set up a Mac. I’ve always wondered how much interest there is to fix this issue and make the Python installer portable (i.e. can install to a location that’s not hard-coded instead e.g. ~/Library).

1 Like

Yes, the fact that you can’t customize the location (or at least have a fixed path for user installs) is what bothers me the most about the Mac installers. You indeed need root access to install and uninstall a Python version with pymac because of this. But I like the other advantages of the Mac installers enough that I can get over this :slightly_smiling_face:

As a side note, you actually can force the PKG installer to install Python in ~/Library instead of /Library, but it seems that the installation is broken then. I didn’t experiment with this a lot though.

Since I’ve tried the Python.org Mac installer I’ve slowly started to stop using pyenv :sweat_smile: