Home > Enterprise >  Xcode script - xargs: python: No such file or directory - Command PhaseScriptExecution failed with a
Xcode script - xargs: python: No such file or directory - Command PhaseScriptExecution failed with a

Time:05-24

After updating to Xcode 13.3.1 and updating comand line tools I cannot build my project. I get error:

Command PhaseScriptExecution failed with a nonzero exit code

python -mjson.tool ./someFileName.json
xargs: python: No such file or directory
Command PhaseScriptExecution failed with a nonzero exit code

The script that failes is:

python -mjson.tool "${TARGET_BUILD_DIR}/${WRAPPER_NAME}/assets/someFileName.json"

It was working fine before. Even if I checkout at the commit that was working I still get the same message. This is why I suspect Xcode update. Does anyone know how to solve this? What does the error mean? What does No such file or directory refer to? Is Python missing (cannot be found)? what is mjson.tool and is it missing? Is someFileName.json missing?

Any help is appreciated :)

CodePudding user response:

Let me answer my own question here :) MacOS 12.3.1 Monterey dropped support for Python 2 and it is removed from the OS. That is what

xargs: python: No such file or directory

was trying to say to me - python is missing. Fortunately Python 3 is installed and you can access it by calling python3 instead of just python. Be ware because python2 code is not always runnable on Python3. Chances are you will need to fix (update) the code. I was lucky and I managed to fix this just by replacing python with python3.

Alternatively you could try to install python2 by hand but this is not recommended.

  • Related