30

Is /usr/bin/python3 provided with macOS Catalina?

2 Answers 2

37

Kinda. A clean installation of Catalina includes a /usr/bin/python3 binary, but it's a stub for installing the command line developer tools, which includes Python 3.

enter image description here

If/when the command line developer tools are installed, the /usr/bin/python3 stub will run the actual python3 binary, but a clean install will just have the stub.

The Python 2 binaries (/usr/bin/python /usr/bin/python2) are still present on a default installation, but they are deprecated and the warning message says they will be removed in future versions.

9
  • 3
    These stub scripts and binaries always make me smile. So much nicer than dumping a text saying to go install and authenticate for changing up a toolset.
    – bmike
    Nov 26, 2019 at 12:18
  • 5
    Conversely, I find it horrifying that a thing called /usr/bin/python3 actually puts out an xcode console message then pops up a dialog box prompting to install something. That is not what /usr/bin/python3 is supposed to do. Nov 26, 2019 at 19:49
  • 3
    @LightnessRaceswithMonica What is it supposed to do when it's not actually installed? This seems like a descendant of what Apple did when they started removing Java from the standard installation.
    – Barmar
    Nov 26, 2019 at 21:21
  • 6
    @Barmar If /usr/bin/python3 is not installed, then attempts to execute it should be met with the standard "file not found" response, whatever that is on your platform. There should simply be no file there at that path, in my opinion. Nov 26, 2019 at 21:22
  • 2
    @bmike "Wouldn't any [..] tool [..] that runs that path surely understand the goal of a stub" Nope. A tool executing /usr/bin/python3 expects Python 3, nothing else. This is pretty fundamental computer stuff! Nov 27, 2019 at 10:55
13

Yes - that file is part of the system image and ships on every Mac.

It is a stub app that calls xcode-select --install which installs all command line developer tools, which includes python3 binary in the same location as the stub binary that installs with the core OS.

When fully installed, version 3.7.3 is what Catalina installs from this stub. Keep in mind python 2.7.16 is the default python if you don’t call python3 up until macOS 12.3 when python binary (which was v2) was removed entirely and python3 was bumped to 3.8.9.

    ~ % /usr/bin/python3 --version
    Python 3.7.3

     ~ % sw_vers
    ProductName:    Mac OS X
    ProductVersion: 12.3
    BuildVersion:   21E230

Catalina:

    ~ % /usr/bin/python3 --version
    Python 3.7.3

    ~ % /usr/bin/python --version
    Python 2.7.16

     ~ % sw_vers
    ProductName:    Mac OS X
    ProductVersion: 10.15.5
    BuildVersion:   19F101

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .