env: python: No such file or directory when building app with Xcode

Homebrew only installs the binary python3, just to be safe. Xcode is complaining about a lack of the binary python (note the lack of a 3!).

You have a couple of options:

  1. When installing python3, Homebrew also creates a libexec folder with unversioned symlinks, such as python (what you’re missing). Note the Caveats printed when installing it:

    $ brew info python
    python@3.9: stable 3.9.10 (bottled)
    ==> Caveats
    Python has been installed as
      /opt/homebrew/bin/python3
    
    Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
    `python3`, `python3-config`, `pip3` etc., respectively, have been installed into
      /opt/homebrew/opt/python@3.9/libexec/bin
    
    See: https://docs.brew.sh/Homebrew-and-Python
    

    You could add this directory to your $PATH, such that python and pip become available; something like the following might suffice:

    echo 'export PATH="'"$(brew --prefix)"'/opt/python@3.9/libexec/bin:$PATH"' \
       >>~/.bash_profile
    

    … although that will need to be modified according to your precise version of Python3, your shell of choice, etc.

  2. Alternatively and more simply, although a little more jankily, you could simply manually create the appropriate symlinks:

    ln -s "$(brew --prefix)/bin/python"{3,}
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)