2

As of macOS 12.3, Apple no longer ships Python 2

However, I am trying to install a program (.pkg installer) that depends on /usr/bin/python and it fails. In /var/log/install.log I see this error:

/usr/bin/python: bad interpreter: No such file or directory

I've already installed Python 2.7 on my system, but the root directory is now read-only so I can't symlink to /usr/bin/python. Disabling SIP does not work. I know there are workarounds for mounting the root system as writable, but that seems like a lot of work given that I need this for a one-time install.

So my question is, is there any other way that I can make the Python binary accessible to the installer via /usr/bin/python?

agarza
  • 2,274
kym
  • 161
  • 3
    Really, the correct answer is for the application developer to fix their broken installer, that depends on absolute paths. SIP doesn't have anything to do with the SSV. – Marc Wilson Apr 07 '22 at 01:46
  • @MarcWilson yea in this case it was the classic shebang on a .py file #!/usr/bin/python – kym Apr 07 '22 at 02:13
  • The correct answer should also be for the app developer to stop using software that was end of life over 2 years ago. I wonder what other security issues the app has? – mmmmmm Sep 05 '22 at 21:33

1 Answers1

4

Ended up solving this by modifying the .pkg myself. The process was:

  • pkgutil --expand to expand the .pkg file into a folder
  • Find + replace /usr/bin/python with the correct path to the python interpreter (in my case it was /Library/Frameworks/Python.framework/Versions/2.7/bin/python)
  • pkgutil --flatten to convert the modified folder back into a .pkg
  • install the new .pkg
kym
  • 161
  • 2
    Probably simpler to use /usr/bin/env python, which will use whatever python is installed, wherever it is. – benwiggy Apr 07 '22 at 07:42